Widget Logic
parent and all of it's childs and grand kids (2 posts)

  1. arizonapain
    Posted 5 years ago #

    How do I make a widget show up on only it's self, child and the child of the child. right now I have global'$post; return (in_array(pain-center,get_post_ancestors($post)));'

    that is not working at all

    link is http://arizonapain.com/pain-center/

  2. alanft
    Plugin Author

    Posted 5 years ago #

    do you have some misplaced quote marks there or is that how your code looks?

    anyway, if you look up what get_post_ancestors does http://codex.wordpress.org/Function_Reference/get_post_ancestors you'll see it returns an array of IDs. so pain-center or 'pain-center', the slug is no use to match with in_array. find the ID of the page and use that integer instead. That should do you.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic