[Resolved] sidebar sub-navigation

Home Forums Support [Resolved] sidebar sub-navigation

Home Forums Support sidebar sub-navigation

  • This topic has 16 replies, 3 voices, and was last updated 7 years ago by Tom.
Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #287901
    Les

    I did several forum searches but couldn’t find a solution.

    I’m looking to do sub-navigation in the left sidebar. I would like only the current website section (not to be confused with GP Sections) and it’s children to appear in the sub menu.

    Is this possible without having to create a separate, stand-alone menu for each section? I would like it if it just used the global menu so that my client just has to maintain one menu.

    Here’s the site I’m working with:
    http://www.vwnaus.com/themeone/sub-navigation/

    Thank you in advance!

    #287976
    Leo
    Staff
    Customer Support

    Hi Les,

    So basically you want a different sidebar menu for each page?

    If so maybe try these two plugins?
    https://wordpress.org/plugins/page-specific-menu-items/
    https://wordpress.org/plugins/menu-swapper/

    It might help if you can provide an example of what you are after.

    #288011
    Les

    Here’s an example of a website that has the side-navigation like I’m referring to.

    http://www.bayoupreservation.org/About/Stewards-of-Our-Bayous

    I want to avoid using something like menu-swapper because with that, you have to create multiple menus.

    Thank you!

    #288015
    Leo
    Staff
    Customer Support

    Hmm then you can try using CSS and target each page and menu item. So something like this:

    .page-id-## .inside-right-sidebar .menu-item-## {
        display: none;
    }

    It will be a bit of work to go through each page but you should be able to keep it to one menu.

    #288018
    Les

    Thank you for the feedback Leo. I was hoping there was something that would be a little more automated. Like to where it would programmatically know what section of the site was the current one; and hide the others.

    Kind of like how WP is able to set the current page class on the li in the menu so you can have the current page/section be a different color. e.g. li.current-menu-parent

    Thanks again!

    #288032
    Les

    This plug-in does (did!) what I want, but it’s very old > https://wordpress.org/plugins/simple-section-navigation/screenshots/

    #288033
    Leo
    Staff
    Customer Support

    You got me thinking and I’m close to getting it to work with CSS…I think…

    #288044
    Les

    Thank you again Leo! I look forward to seeing what you come up with.

    Also, I stumbled across this which may be another option:
    https://wordpress.org/plugins/bu-navigation/faq/
    http://developer.bu.edu/bu-navigation/
    https://github.com/bu-ist/bu-navigation/wiki/Content-Navigation-Widget

    #288077
    Les

    All told Leo, I love the idea of a simple CSS solution. Looking forward to what you find out!

    #288298
    Les

    Any updates on the CSS solution? Thank you!

    #288316
    Tom
    Lead Developer
    Lead Developer
    #288435
    Leo
    Staff
    Customer Support

    If Tom doesn’t think it’s possible with CSS then it’s definitely not possible. sorry to get your hopes up! Looks like a plugin would have to do.

    #288437
    Les

    Thank you Tom!

    I’d like to avoid another plug-in, so I’m trying the WP Tutorial you linked.

    Added this to my child-theme functions.php:

    //sub-page display from -> http://www.wpbeginner.com/wp-tutorials/how-to-display-a-list-of-child-pages-for-a-parent-page-in-wordpress/
    function wpb_list_child_pages() {
    global $post;
    if ( is_page() && $post->post_parent )
    $childpages = wp_list_pages( ‘sort_column=menu_order&title_li=&child_of=’ . $post->post_parent . ‘&echo=0’ );
    else
    $childpages = wp_list_pages( ‘sort_column=menu_order&title_li=&child_of=’ . $post->ID . ‘&echo=0’ );
    if ( $childpages ) {
    $string = ‘

      ‘ . $childpages . ‘

    ‘;
    }
    return $string;
    }
    add_shortcode(‘wpb_childpages’, ‘wpb_list_child_pages’);

    I attempted to create a new page template by duplicating the GP page.php file and adding it to my child theme directory… but since this is related to the sidebar, I think that I’ll need to hunt for a different tutorial.

    I also tried to add the shortcode [wpb_childpages] to my left sidebar widget, but nothing displays on the front-end.

    http://www.vwnaus.com/themeone/sub-navigation/

    Thank you again for the assist!

    #288539
    Leo
    Staff
    Customer Support

    Looks like you got it working&gt? I see the submenu in the sidebar now.

    #288565
    Tom
    Lead Developer
    Lead Developer

    Using [wpb_childpages] in your text widget would be the way to go for sure 🙂

Viewing 15 posts - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.