[wp-testers] is_page('Education & Outreach')

Philip M. Hofer (Frumph) philip at frumph.net
Wed May 12 07:23:01 UTC 2010


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" <johnbillion+wp at gmail.com>
To: <wp-testers at lists.automattic.com>
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 <dgs at riskiii.com> 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
> wp-testers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-testers
> 



More information about the wp-testers mailing list