WordPress.org

Forums

Widget Logic multiple pages doesn't work on one statement (4 posts)

  1. antorera
    Member
    Posted 5 years ago #

    Hello,

    I am trying to create a different icon in a sidebar for each section of the site. I decided to use WidgetLogic to make this happen. However, I am finding that it will only work for the first page included in the conditional statement.

    For example, is_page('2','15','23')

    Here are live examples:

    Works on this page (first page id in the series), where you see the illustration of the olive leaves in a jar on the left.

    Here's another page (which is a subpage of the previous) where it doesn't show up.

    I've tried using single quotes, no quotes, actual page names, but to no avail.

    Would appreciate any feedback, as the whole schema is built around this working! Let me know if there is furter information I can provide.

    Many thanks in advance.

  2. Alengka
    Member
    Posted 5 years ago #

    If you put the pages in an array it should work.

    is_page(array(2,15,23))

    It worked like that for me.

    If it doesnt work you can find more information about this on this link

    Good luck!

  3. antorera
    Member
    Posted 5 years ago #

    The array statement was perfect! Thanks.

  4. helloari
    Member
    Posted 4 years ago #

    the flip side is if you dont want a widget to display on just a few pages. in that case try
    !is_page('10') && !is_page('13')
    and you can string together more like this
    !is_page('10') && !is_page('13') && !is_page('22')

Topic Closed

This topic has been closed to new replies.

About this Topic