[wp-hackers] $single

Matt Mullenweg m at mullenweg.com
Wed Jun 16 05:16:26 UTC 2004


jill wrote:

> Last night I was running searches on the forum on '$single', hoping to find something
> definitive on '$somthingotherthansingle,maybecatorplural' and ended with an inference
> that $cat is in fact a (maybe) global that distinguishes category page views from all the other
> varieties. If WP had a tech writing team whose interests and availability matched that of the
> dev group, stuff like that would be indexed to the point of being blazingly obvious to the
> most inept seeker. But documentation always plays catch-up to development, it's just the
> nature of the beast. WP development has yet to settle down long enough for documentation
> efforts to get a grip on everything that's been so far coded.

This is actually a good topic to bring up.

$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.

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?

-- 
Matt Mullenweg
  http://photomatt.net | http://wordpress.org
http://pingomatic.com | more soon...




More information about the hackers mailing list