WordPress.org

Ready to get started?Download WordPress

Forums

Widget Logic
Page of Parent Page (3 posts)

  1. bplumb
    Member
    Posted 12 months ago #

    Hi,

    I am trying to get a widget to show when it is page XYZ or a child of XYZ (page 4).

    I have used:

    is_page('XYZ') || ($post->post_parent=="4")

    If I am on mysite.com/XYZ then it works fine, but as soon as I am on mysite.com/XYZ/ABC it no longer shows (even though XYZ is page 4 and set to be a parent of page ABC).

    Any ideas?

    http://wordpress.org/plugins/widget-logic/

  2. thomasjojo
    Member
    Posted 12 months ago #

    Did you find out of this? I need that too. BUt as you say, it does not work.

  3. bplumb
    Member
    Posted 11 months ago #

    Yep, sorted. You need to ensure your code is exactly as laid out in the Other Notes pages...

    global $post; return (is_page('XYZ') || ($post->post_parent=="4"));

    This will work perfectly!

Reply

You must log in to post.

About this Plugin

About this Topic