WordPress.org

Ready to get started?Download WordPress

Forums

menu with paren and children without grand child (1 post)

  1. floyergilmour
    Member
    Posted 8 months ago #

    Hi im trying to create a menu with parent on top then i child (sub-menu), but when clicking on a grand child (which is a link on the child page) the child sub menu disappears or is replaced with the grand child pages instead of the child pages. Here is my code

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

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    thanks

Reply

You must log in to post.

About this Topic

  • RSS feed for this topic
  • Started 8 months ago by floyergilmour
  • This topic is not resolved
  • WordPress version: 3.4.2