[wp-hackers] Options for Controller - Views
mikeschinkel at newclarity.net
Fri Nov 20 17:52:19 UTC 2009
On Nov 20, 2009, at 12:22 PM, Otto wrote:
> Email me direct with the code you have and I'll see if I can help you
> simplify it.
> If you can get the variables you need into query vars, then it should
> be a straightforward matter to pull the posts you need, and hopefully
> to do it without direct SQL modification. However, that's not a
> routing issue at all, that's an issue with WP_Query and it being
> potentially unable to query your posts in the way you want.
I know that's the theory, but I wasn't able to make it work in reality.
> But again, *you don't need to use WP_Query*. A template never has to
> mess with the $wp_posts variable if it doesn't want to do so. You can
> ignore it entirely and pull the posts you want yourself.
I can do that but then I'm duplicating far too much code.
BTW, one of the things I was doing it creating a Shortcode to return a list of "Solutions" (i.e. posts of "type" "solution") and embed within another post. I had to do it that way because of the way Wordpress hijacks things but honestly that was 6 months ago and I can't remember exactly what the problem was.
> Or create a
> new WP_Query with special parameters. Or anything you like, once
> you're in your template (via a template_redirect), you have total
> control over everything. Everything is loaded, all of WordPress is
> prepared, but it's the template that waves the baton and displays
I was trying to create routing that had as little impact on how other things are done as possible. Sure, i can write a lot of custom code but I was trying my best to avoid it.
> Routing arbitrary URLs to custom functions (via callbacks) is easy
> verging on trivial.
Yes, but once in the custom function you have to do far too much work; it shouldn't be like that.
As I remember, to fix it would require some new hooks and some changes in some internal assumptions when a custom route is in use.
> Custom post type might be, but I need more
> information on that.
In your email.
WordPress Custom Plugins
More information about the wp-hackers