It accepts page name.

elseif ( in_array( $page_obj->post_title, $page ) )
else if ( in_array( $page_obj->post_name, $page ) )

^ is that space between the second else if supposed to be there? /shrug, need to go back to sleep.

Anyways it probably should be using the slug and sanitized anyways.


----- Original Message ----- From: "John Blackbourn" <[email protected]>
To: <[email protected]>
Sent: Wednesday, May 12, 2010 12:12 AM
Subject: Re: [wp-testers] is_page('Education & Outreach')


On Wed, May 12, 2010 at 2:45 AM, Danny G Smith <[email protected]> wrote:
It appears that is_page is not sanitizing the input text, at least that is my guess, when I use 'Education & Outreach' which it the page title, it does not work, but if I use the page number 25 it does.

is_page() only accepts a page ID or an array of page IDs to check. It
would probably be useful if it did accept page names (or more
specifically, page paths).

I usually stick a wrapper function in my theme's functions.php file:

function is_page_by_name( $name ) {
   $page = get_page_by_path( $name );
   if ( $page )
       return is_page( $page->ID );
   return false;
}

John
_______________________________________________
wp-testers mailing list
[email protected]
http://lists.automattic.com/mailman/listinfo/wp-testers


_______________________________________________
wp-testers mailing list
[email protected]
http://lists.automattic.com/mailman/listinfo/wp-testers

Reply via email to