Forums

list pages three separate navs (1 post)

  1. taylerjay
    Member
    Posted 1 year ago #

    Hello, I've been using the code:
    <?php wp_list_pages('title_li=&depth=1'); ?>
    to list all my parent pages horizontally in header navigation in a site that is not live yet.

    I've also been using this:

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

    to list all child pages (which also shows grandchild pages which I'd like to avoid).

    What I would ideally like to do is have parent page list on all pages, child page list in a sub navigation of a ancestor page only and a third navigation (grandchild page) to appear in the sidebar navigation on child pages only.

Topic Closed

This topic has been closed to new replies.

About this Topic