• ryanoryan

    (@ryanoryan)


    Hi,

    I am trying to exclude a widget from pages, subpages and a category of posts.

    This is the statement I have at the moment:

    global $post; return ! (is_page(‘5’) || ($post->post_parent==”5″)) || is_single() && in_category( ‘7’ ) ;

    It is removing it correctly for pages and subpages but can’t get it to work on the posts?

    Any idea where I am going wrong?

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • alanft

    (@alanft)

    you need to bracket together

    (is_single() && in_category(‘7’))

    Thread Starter ryanoryan

    (@ryanoryan)

    Ah yes, thank you. had to change it slightly to work but you put me on the right track, working code:

    global $post; return ! (is_page(‘5’) || ($post->post_parent==”5″) || is_single() && in_category( ‘7’ )) ;

    Thanks again

    CorgBrannon

    (@corgbrannon)

    How do you exclude a widget from one single page or a number of pages? Can’t seem to find it in the FAQs.

    Thx

    Thread Starter ryanoryan

    (@ryanoryan)

    You just add ! before hand.

    e.g. ! (is_page(‘5’)

    Thread Starter ryanoryan

    (@ryanoryan)

    ! (is_page(‘5’) )

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘[Plugin: Widget Logic] Help with conditional statement’ is closed to new replies.