WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Text Widget
Child of Condition (2 posts)

  1. paul@effigy.com.au
    Member
    Posted 3 years ago #

    Just wondering what would be the argument to add to the settings to filter pages if they were the child of a particular page.

    That is to say I only want the Widget to show up on pages that are children of a particular Parent page.

    Thanks in Advance.

    http://wordpress.org/extend/plugins/advanced-text-widget/

  2. Max Chirkov
    Member
    Plugin Author

    Posted 3 years ago #

    Since there is no single conditional function that determines hierarchy of pages, I would recommend creating a custom function like is_parent($page_id) - which later you could use anywhere else including the ATW conditions. Take a look at "Testing for sub-Pages" section on this page http://codex.wordpress.org/Conditional_Tags their example of is_subpage() function is almost exactly what you need, in your case you just need to pass an argument (page id) and compare it to the $post->post_parent (like $page_id == $post->post_parent). That's it.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic