[wp-hackers] $single

jill jill at pericat.ca
Wed Jun 16 06:40:09 UTC 2004


Matt Mullenweg wrote:

>$single is set to true when wp-blog-header.php returns only one post. 
>There are no equivilents for saying "you're on a monthly archive page" or 
>"you're on a category page." The best you can do is check heuristically 
>for things like $cat or $category_name. This isn't perfect as $cat is 
>often set to restrict categories shown on different pages.

Ah, that would explain why $single gets the ink and $cat's hidden away in the kitchen. It
still seems set enough for what I want of it, which is to be non-zero if "category" is in the
path.

>What do you guys think of a set of variables like so that would be set by 
>blog-header:
>
>$on_single = $single
>$on_category
>$on_subcategory
>$on_day
>$on_month
>$on_year
>
>Any more?

$on_holiday? (you did ask.)

At bottom, definite declarations of that kind allow me to, with some confidence, set up
differences between a number of page views. I prefer on/off values and individual variables,
as that lets me set up views based on combinations that no one but I would care about.

pericat
-- 
<http://pericat.ca/>



More information about the hackers mailing list