Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #101427

    CodeYoda
    Participant

    I would like to display different menus on different pages. So for instance if a user was on the home page then they primary menu is rendered as the nav menu at the top of the page. However if they click through to a separate page then I want a different custom menu to be rendered for the main top nav menu.

    I can create a custom menu but I can’t work out how to add a specific custom menu to individual pages, or groups of pages.

    Your help and guidance here is much appreciated.

    (I am using the Renew stack.)

    #101476

    Mrinal
    Member

    Hi There,

    You’ve use an external plugin to do so, http://wordpress.org/plugins/menu-swapper/ which allows you to specify menu per page/post basis. Check it’s video (link in it’s description) to get started.

    #101910

    CodeYoda
    Participant

    That plugin was just what I was looking for! Thanks, you guys are awesome.

    #101929

    Christian
    Moderator

    You’re welcome.

    #111999

    atulstays
    Participant

    Hello x team ,

    Thanx for this question Code Yoda , because i am also going through same issue.

    However , the link of the plugin that X team mentioned -> https://wordpress.org/plugins/menu-swapper/ is not compatible upto wordpress version 3.5 , and i m running on version 4 . So how do i make different menus on differnt pages . It would be very nice of X team , if you can suggest me something for this . Thanx in advance 🙂

    #112046

    Paul R
    Moderator

    Hi,

    Thanks for writing in.

    I just tested that plugin on a test site that runs wp version 4 and xtheme 2.5.1 and didn’t found any issues.
    You can try using it if suits your needs.

    Best Regards.

    #122353

    CodeYoda
    Participant

    Hi Suppport,

    I found the plugin works great except on the blog and home pages. Do you know why this would be the case? How can I put a different menu on my blog page?

    my site: http://www.codeyoda.co.za

    Thanks a million.

    #122620

    Nabeel A
    Moderator

    Hi again,

    Maybe because you’re using a one page navigation that’s why it’s not working on homepage. For the blog page use the metabox to replace existing menu theme locations with your new theme locations.

    #123047

    CodeYoda
    Participant

    Thanks for your response, however it works on all other pages, even with 1 page naviagation except the blog page and home pages. Is it possible for you to advise on how to do this manually?

    #123313

    Rad
    Moderator

    Hi there,

    In that case please provide your admin login credentials in private.

    Thanks.

    #124741

    CodeYoda
    Participant
    This reply has been marked as private.
    #124992

    Paul R
    Moderator

    Hi,

    You can do this manually by creating the file _navbar.php in x-child-integrity-light/framework/views/global/

    Then copy the code below into that file.

    
    <?php
    
    // =============================================================================
    // VIEWS/GLOBAL/_NAVBAR.PHP
    // -----------------------------------------------------------------------------
    // Outputs the navbar.
    // =============================================================================
    
    $navbar_position = x_get_navbar_positioning();
    $logo_nav_layout = x_get_logo_navigation_layout();
    $is_one_page_nav = x_is_one_page_navigation();
    
    ?>
    
    <?php if ( ( $navbar_position == 'static-top' || $navbar_position == 'fixed-top' || $is_one_page_nav ) && $logo_nav_layout == 'stacked' ) : ?>
    
      <div class="x-logobar">
        <div class="x-logobar-inner">
          <div class="x-container-fluid max width">
            <?php x_get_view( 'global', '_brand' ); ?>
          </div>
        </div> <!-- end .x-logobar-inner -->
      </div> <!-- end .x-logobar -->
    
      <div class="x-navbar-wrap">
        <div class="<?php x_navbar_class(); ?>">
          <div class="x-navbar-inner">
            <div class="x-container-fluid max width">
              <?php if(is_page( array( 1,2,3,4,5 ) )): ?>
                   <?php
                        wp_nav_menu( array(
                          'menu' => 'Alternative Nav Menu',
                          'container'      => false,
                          'menu_class'     => 'x-nav sf-menu',
                        ) );
                   ?>
              <?php else: ?>
                  <?php x_get_view( 'global', '_nav', 'primary' ); ?>
              <?php endif; ?>
            </div>
          </div> <!-- end .x-navbar-inner -->
        </div> <!-- end .x-navbar -->
      </div> <!-- end .x-navbar-wrap -->
    
    <?php else : ?>
    
      <div class="x-navbar-wrap">
        <div class="<?php x_navbar_class(); ?>">
          <div class="x-navbar-inner">
            <div class="x-container-fluid max width">
              <?php x_get_view( 'global', '_brand' ); ?>
              <?php if(is_page( array( 1,2,3,4,5 ) )): ?>
                   <?php
                        wp_nav_menu( array(
                          'menu' => 'Alternative Nav Menu',
                          'container'      => false,
                          'menu_class'     => 'x-nav sf-menu',
                        ) );
                   ?>
              <?php else: ?>
                  <?php x_get_view( 'global', '_nav', 'primary' ); ?>
              <?php endif; ?>
            </div>
          </div> <!-- end .x-navbar-inner -->
        </div> <!-- end .x-navbar -->
      </div> <!-- end .x-navbar-wrap -->
    
    <?php endif; ?>
    

    Replace 1,2,3,4,5 with page ids where you like your alternative menu to appear.

    Here is how to locate page ids.

    http://theme.co/x/member/kb/how-to-locate-post-ids/

    Hope that helps.

    #125595

    CodeYoda
    Participant
    This reply has been marked as private.
    #125881

    Zeshan
    Member

    Hi there,

    Thank you for writing in!

    Upon checking, it seems you want to target blog page, in that case, please use the following code instead:

    
    <?php
    
    // =============================================================================
    // VIEWS/GLOBAL/_NAVBAR.PHP
    // -----------------------------------------------------------------------------
    // Outputs the navbar.
    // =============================================================================
    
    $navbar_position = x_get_navbar_positioning();
    $logo_nav_layout = x_get_logo_navigation_layout();
    $is_one_page_nav = x_is_one_page_navigation();
    
    ?>
    
    <?php if ( ( $navbar_position == 'static-top' || $navbar_position == 'fixed-top' || $is_one_page_nav ) && $logo_nav_layout == 'stacked' ) : ?>
    
      <div class="x-logobar">
        <div class="x-logobar-inner">
          <div class="x-container-fluid max width">
            <?php x_get_view( 'global', '_brand' ); ?>
          </div>
        </div> <!-- end .x-logobar-inner -->
      </div> <!-- end .x-logobar -->
    
      <div class="x-navbar-wrap">
        <div class="<?php x_navbar_class(); ?>">
          <div class="x-navbar-inner">
            <div class="x-container-fluid max width">
              <?php if(is_home()): ?>
                   <?php
                        wp_nav_menu( array(
                          'menu' => 'Alternative Nav Menu',
                          'container'      => false,
                          'menu_class'     => 'x-nav sf-menu',
                        ) );
                   ?>
              <?php else: ?>
                  <?php x_get_view( 'global', '_nav', 'primary' ); ?>
              <?php endif; ?>
            </div>
          </div> <!-- end .x-navbar-inner -->
        </div> <!-- end .x-navbar -->
      </div> <!-- end .x-navbar-wrap -->
    
    <?php else : ?>
    
      <div class="x-navbar-wrap">
        <div class="<?php x_navbar_class(); ?>">
          <div class="x-navbar-inner">
            <div class="x-container-fluid max width">
              <?php x_get_view( 'global', '_brand' ); ?>
              <?php if(is_home()): ?>
                   <?php
                        wp_nav_menu( array(
                          'menu' => 'Alternative Nav Menu',
                          'container'      => false,
                          'menu_class'     => 'x-nav sf-menu',
                        ) );
                   ?>
              <?php else: ?>
                  <?php x_get_view( 'global', '_nav', 'primary' ); ?>
              <?php endif; ?>
            </div>
          </div> <!-- end .x-navbar-inner -->
        </div> <!-- end .x-navbar -->
      </div> <!-- end .x-navbar-wrap -->
    
    <?php endif; ?>
    

    Hope this helps. 🙂

    Thank you.

    #126158

    CodeYoda
    Participant

    Legends! You guys are awesome – thanks very much. Working perfectly as expected now.

    I’ll def be purchasing the X theme again for future website builds 🙂