Support » Fixing WordPress » Displaying one set of subpages on all subpages

  • Hi,

    I’m having trouble pulling in a pages subpages and having them be displayed on the subpages themselves.

    I have manually listed the parent page items and want to target a particular pages subpages to be displayed below the corresponding parent page.

    I am using the following code, it works to a point, but it also pulls in the other subpages:

    <?php if($post->post_parent){
                $children = wp_list_pages("title_li=&child_of=7&echo=0");
            }else{
                $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
            }
            if ($children) { ?>
                <ul>
                    <?php echo $children; ?>
                </ul>
            <?php } ?>

    The parent page ID is ‘7’.

    Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • This is how it looks in the list (the parent page is ‘About Us’):

    <li><a href="<?php echo get_permalink(7); ?>">About Us</a></li>
            <?php if($post->post_parent){
                $children = wp_list_pages("title_li=&child_of=7&echo=0");
            }else{
                $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
            }
            if ($children) { ?>
                <ul>
                    <?php echo $children; ?>
                </ul>
            <?php } ?>
            <li><a href="<?php echo get_permalink(9); ?>">News</a></li>
            <li><a href="<?php echo get_permalink(11); ?>">Gallery</a></li>

    BUMP. I really need help with this

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displaying one set of subpages on all subpages’ is closed to new replies.