Forums

[resolved] Displaying children of pages in navigation (3 posts)

  1. Christine
    Moderator
    Posted 2 years ago #

    I've moved a site from my server to my clients IIS server and ran into a problem with the plugin is_child.

    I've deactivated the plugin and changed my navigation from:

    <?php if (is_page(28) || is_child(28)) { ..?>
    
    to <?php if (is_page(28) || $post->post_parent == '28') {?>

    My sidebar displays the right pages if I go to the about or a child of about. But if I go to the grandchildren, then the nav doesn't work anymore. Is there a plugin other than the is_child plugin that can do this or an equivalent to $post->post_parent that will display all of the children up to 4 levels deep?

  2. Tzaddi
    Member
    Posted 2 years ago #

    I found a blog post which mentions using get_post_ancestors to find the top level page, which may help you. The solution is covered in depth here:

    http://www.cmurrayconsulting.com/wordpress-tips/current-section-navigation-wordpress/

    Hope it helps!

  3. Christine
    Moderator
    Posted 2 years ago #

    Hey Z,

    Thanks for this. I read the post twice and didn't understand a thing. But I saw that they came up with a plugin http://wordpress.org/extend/plugins/simple-section-navigation/

    Thank fully that plugin fixed my problem and works like a charm.

Topic Closed

This topic has been closed to new replies.

About this Topic