• Resolved brody_zen

    (@brody_zen)


    I am using a plugin called widget logic

    i want to tell a widget to only display on certain pages.

    The is the code they provide
    is_page(‘about’)

    it works but i would like to designate multiple pages.

    how do i write that

    thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • https://codex.www.ads-software.com/Function_Reference/is_page

    is_page(array(42,'about-me','Contact'));
    // Returns true when the Pages displayed is either post ID 42, or post_name "about-me", or post_title "Contact".  Note: the array ability was added at Version 2.5.
    Thread Starter brody_zen

    (@brody_zen)

    Thank you very much
    so if i am calling out a number of pages does this look right

    is_page(array(‘about’,’Contact’,’Samples’,’Portfolio’));

    Thread Starter brody_zen

    (@brody_zen)

    Ok that did work.

    Perfect. Only think is now i can’t identify the index page.

    it is not a static page but rather a your latest post page.

    the post id on that page is hello-world.

    how can i add that to the array?

    you cannot add it to the array, but work with boolean operators:

    is_home() || is_page(array('about','Contact','Samples','Portfolio'))

    if it does not work with is_home() try to use is_front_page() ;

    (i assume that widget logic will work with these operators; for instance:

    || is OR
    && is AND

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘is_page('about')’ is closed to new replies.