WordPress.org

Ready to get started?Download WordPress

Forums

Widget Logic
conditional statement help (1 post)

  1. willie_dixon
    Member
    Posted 3 years ago #

    Here's what I have

    global $post; return is_page(7) || ($post->post_parent=="7") || in_array('7', $post->ancestors);

    which includes the widget on a page and all children/grandchildren.

    This works except on the posts page. I have a static homepage and the post page is called "News". The widget works as intended but it shows up on my News page as an array error message. It doesn't show up on individual post pages.

    I have tried this:

    global $post; return is_page(7) || ($post->post_parent=="7") || in_array('7', $post->ancestors) || is_page(75);

    where 75 is the page ID for the News page. I have also tried a few other things but can't get the widget to NOT appear on the News page.

    Anyone have input as to how I can exclude the News page?

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic