• Hi everybody,

    i have a menu like this:

    item a
    item b
    subitem 1
    subitem 2
    subitem 3
    item c

    When i click on subitem 1, i see only the subitem (1, 2 and 3), but i want to see the parent item b and also item a and c.

    I’m using this script but it isn’t what i want because it displays only subitems without the item:
    <?php
    if ( $post->post_parent ) {
    $children = wp_list_pages( array(
    ‘title_li’ => ”,
    ‘child_of’ => $post->post_parent,
    ‘echo’ => 0
    ) );
    $parent_title = get_the_title($post->post_parent);
    } else {
    $children = wp_list_pages( array(
    ‘title_li’ => ”,
    ‘child_of’ => $post->ID,
    ‘echo’ => 0
    ) );
    }
    if ( $children ) : ?>

      <?php echo $children; ?>

    <?php endif; ?>

    Thank you

  • The topic ‘Sub menu with child and parent’ is closed to new replies.