[wp-hackers] Re: $single

Joseph Scott joseph at randomnetworks.com
Sun Jun 20 20:58:25 UTC 2004


On Jun 20, 2004, at 12:13 PM, Ryan Boren wrote:

> On Wed, 2004-06-16 at 12:30, David Chait wrote:
>> Yeah, I agree on both points.
>>
>> For page_type, I'm not sure what's needed more than home, single, 
>> archive --
>> in terms of raw usage.  Maybe a secondary variable to get more 
>> specific, but
>> then again for people like me, if it isn't home or single, it's 
>> archive...
>> ;)
>
> Here's what I have:
>
> is_single()
> is_date()
> is_category()
> is_author()
> is_archive() = date || category || author
> is_search()
> is_feed()
>
> These return true or false.

	Any reason why these couldn't be in an array?  Something like:

$wp_info = array (
	'is_single'		=> false,
	'is_date'		=> false,
	...
	'is_feed'		=> false
);

	What exactly to call it and what should be included may need some 
discussion.  Seems like creating functions just adds more namespace 
issues.  Perhaps some of the existing functions (like bloginfo) could 
also be replaced by one master $wp_info array, which sub arrays for 
each category.  That would make the above example something like:

$wp_info = array(
	'blog_info'		=> array(
		'rss_url'	=> 'http://www.example.com/rss',
		...
	),
	'page_info'	=> array(
		'is_single'	=> false,
		...
	),
	...
);

	With something like that $wp_conf would be the only variable that 
would need to made 'global' inside functions.  With print_r people 
would be able to easily figure out which settings are available to them 
for use in their pages and plugins.

--
Joseph Scott
http://joseph.randomnetworks.com/




More information about the hackers mailing list