Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1321280
    wisdomandcraft
    Participant

    Hi – I found a few posts on this topic, but nothing solved definitively. Here’s the scenario – Two menus on the same page – 1) the main menu provided by the theme, and 2) a submenu appearing on only one page.

    When I turn on the one-page nav through Cornerstone and select the submenu, the main menu disappears. Is there a way to keep the main menu and add the sub menu at the same time?

    Thanks for your help,
    Chris

    #1321376
    Nico
    Moderator

    Hi There,

    Thanks for writing in.

    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    Thanks.

    #1321707
    wisdomandcraft
    Participant
    This reply has been marked as private.
    #1321727
    wisdomandcraft
    Participant
    This reply has been marked as private.
    #1321863
    Rue Nel
    Moderator

    Hello There,

    Thanks for updating in! Regretfully the given access to your WP dashboard is now working for us. It looks like the username is invalid. Please double check it for us. Meanwhile, when you apply the one page navigation menu, your will need two sets of menu. One menu will be for the primary menu and the second menu which would have the sub menu, will be used exclusively for the one page navigation menu.

    Hope this helps. Please let us know how it goes.

    #1322618
    wisdomandcraft
    Participant
    This reply has been marked as private.
    #1322802
    Jade
    Moderator

    HI there,

    Please follow the instructions on this thread: https://community.theme.co/forums/topic/add-an-additional-menu-under-the-top-menu/#post-28739

    Hope this helps.

    #1324198
    wisdomandcraft
    Participant

    Okay. Thanks! I added the sub-menu – 2 things though: how do I get it take on the x-theme scrollspy? AND make the primary the “main menu”? The one-page is still swapping out the primary menu and putting in the sub.

    #1324857
    wisdomandcraft
    Participant

    Okay – this seems buggy… After adding this to functions.php

    function register_submenu() {
      register_nav_menu('submenu',__( 'Sub Menu' ));
    }
    add_action( 'init', 'register_submenu' );

    I added this to the theme:

    <div class="submenu-container">
          <?php wp_nav_menu( array( 'theme_location' => 'submenu', 'container_class' => 'submenu' ) ); ?>
    </div>

    Which gives me a second menu on the page, but when I select this for the one-page nav, it puts the submenu nav in the primary spot – even though the menu in the submenu spot. Please help, i’ve been dealing with this for days and we’re trying launch the site this week.

    #1324859
    wisdomandcraft
    Participant

    Oh, also, how can have this appear on only one page? i.e. use Cornerstone to apply the navigation?

    #1325012
    Christopher
    Moderator

    Hi there,

    Please update your code to :

    
    <?php if (is_page('34')): ?>
    
    <div class="submenu-container">
          <?php wp_nav_menu( array( 
          'theme_location' => 'submenu', 
          'container_class' => 'submenu',
            'container'      => false,
            'menu_class'     => 'x-nav x-nav-scrollspy',
            'link_before'    => '<span>',
            'link_after'     => '</span>'
    
           ));
    
           ?>
    </div>
    
    <?php endif; ?>

    It should be displayed on page with ID 34.

    Hope it helps.

    #1325513
    wisdomandcraft
    Participant

    Okay.
    It was actually page ID 44, but this is starting to work. We’re getting really close. Thank you so much!

    It links down to the sections, but what do we do to highlight a link for the section in view? That is, how do we append the “current-menu-item” class to the link’s class attribute?

    From there, I should be able to apply remaining styles.

    Thanks again!
    C

    #1325866
    wisdomandcraft
    Participant
    This reply has been marked as private.
    #1326146
    Rad
    Moderator

    Hi there,

    Please add this code to Admin > Appearance > Customizer > Custom > Javascript

    jQuery( function($) { $('.submenu-container a').click( function(){
    
    $('.submenu-container li').removeClass('current-menu-item');
    $(this).parent().addClass('current-menu-item');
    
    } ); } );

    And change this code

    <?php wp_nav_menu( array( 
          'theme_location' => 'submenu', 
          'container_class' => 'submenu',
            'container'      => false,
            'menu_class'     => 'x-nav x-nav-scrollspy',
            'link_before'    => '<span>',
            'link_after'     => '</span>'
    
           ));
    
           ?>

    to this

    <?php wp_nav_menu( array( 
          'theme_location' => 'submenu', 
          'container_class' => 'submenu',
            'container'      => false,
            'menu_class'     => 'x-nav',
            'link_before'    => '<span>',
            'link_after'     => '</span>'
    
           ));
    
           ?>

    ScrollSpy is already applied to the primary menu, and it’s responsible for highlighting the primary menu items resetting the highlight of other existing items.

    Thanks!

    #1326263
    wisdomandcraft
    Participant

    Thanks, Rad – I don’t want the primary menu to be the scrollspy menu, though. I want the submenu to do that job. I have a different menu for primary – “main.” How can I turn on the scrollspy/single-page nav, set it to the Submenu, and keep the primary/main nav at the top, x-nav? (submenu is incorrectly being displayed there now).

    Thanks,
    Chris

  • <script> jQuery(function($){ $("#no-reply-1321280 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>