• kastiauto

    (@kastiauto)


    Hello

    I have product navigation menu from pages like

    • Cat 1
    • Product 1
    • Product 2
    • Model 1
    • Model 2
    • Cat 2
    • Cat 3

    When I click on Model 1, my menu collapses and become

    • Cat 1
    • Cat 2
    • Cat 3
    • Model 1
    • Model 2

    How can I change this, so the menu stays expandend on Model 1 or Model 2

    I’am using code from here

    $ancestor_id = 1843; // you want to change this
    $descendants = get_pages( array( 'child_of' => $ancestor_id ) );
    $incl = '';
    
    foreach ( $descendants as $page ) {
        if ( ( $page->post_parent == $ancestor_id )
            || ( $page->post_parent == $post->post_parent )
            || ( $page->post_parent == $post->ID )
        ) {
            $incl .= $page->ID . ",";
        }
    }
    ?>
    
    <ul>
        <?php
        wp_list_pages( array(
            'child_of'    => $ancestor_id,
            'include'     => $incl,
            'link_before' => '',
            'title_li'    => '',
            'sort_column' => 'menu_order'
        ) );
        ?>
    </ul>
  • The topic ‘wp_list_pages grandchild brakes order’ is closed to new replies.