[wp-hackers] Avoiding Side-effects in Filters & Actions
Mike Schinkel
mikeschinkel at newclarity.net
Sun Apr 5 22:56:34 GMT 2009
You are probably right. Right in the sense that it will probably be more effort to convince people to incorporate into WP core rather than just build what I need for my own use and beg for the hooks that are needed but not yet there.
-Mike
----- Original Message -----
From: "Jeremy Clarke" <jer at simianuprising.com>
To: wp-hackers at lists.automattic.com
Sent: Sunday, April 5, 2009 5:42:22 PM GMT -05:00 US/Canada Eastern
Subject: Re: [wp-hackers] Avoiding Side-effects in Filters & Actions
Mike, I think that you're probably doing more work than you need to. I
don't want to just repeat what's already been said, but it sounds like
most of what you need is available from the is_x() functions like
is_page() and is_date(). The actual class that is used is the
$wp_query object. It's not perfect, and unfortunately there's no
canonical $wp_query->type variable that would hold something like
'category', but instead there are just all the different variables
that define the context and they are accessed indirectly using the
is_type() functions. It would be really hard and IMHO barely useful to
have a overarching text description of the current context because of
things like category archives that are also paged, or
date-page-category archives (?cat=3&m=200809&paged=2) that would make
it really complicated. I'm not sure why you would be parsing the query
string yourself, that sounds completely wrong, as its already done by
core and fit into the $wp_query object.
Another part of your problem would probably be solved using custom
fields. What I do is just write my own is_x() functions that check
custom fields (or categories, or whatever) and work them into my logic
along with the core ones. Admittedly its not perfect but I think the
problems your having are going to be there no matter what, it just
comes with the territory unless you expect a full-on UI for managing
all the contextual content blocks (and my experiences with Drupal make
me pretty skeptical that that is any easier to manage than php is_x()
functions unless you don't know any php).
--
Jeremy Clarke | http://simianuprising.com
Code and Design | http://globalvoicesonline.org
_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers
More information about the wp-hackers
mailing list