Take your website
To the next level
Discover our newly launched customization services and elevate your web projects to new heights.
Delegate tasks, save time, and unlock the power of professional WordPress outsourcing.

Okay
  Public Ticket #1800015
Conditional Menu
Closed

Comments

  • ottimoto started the conversation

    Hi there,

    I'm developing a long scrolling one pager with TheGem, which will also include a blog on one separate page. The blog posts obviously open on a separate page (single blog post page), which is fine, but I would need a different navigation on those single pages in order to direct the user back to the main long scrolling page. I tried various plugins but they all do not work with your theme. I also tried to change the code in the header of my child theme without any luck:

    <?php wp_nav_menu(array('theme_location' =--> 'primary', 'menu_id' => 'primary-menu', 'menu_class' => apply_filters( 'thegem_nav_menu_class', 'nav-menu styled no-responsive' ), 'container' => false, 'walker' => new TheGem_Mega_Menu_Walker)); ?>
    

    change to something like

    <?php wp_nav_menu( array( 'theme_location' =----> 'primary', 'menu_id' => 'primary-menu', 'menu_class' => 'back-for-good-blog-menu' ) ); ?>
    

    I'm developing still locally, so can not share a URL.

    Many thanks

    otti


  • ottimoto replied

    Addition:

    I came so far, but would require the change/replacement code for the  else loop below in order to select a second menu in Appearance -> Menu called back-for-good-blog-menu

    <?php if ( is_front_page() ) : ?>
        <?php wp_nav_menu(array('theme_location' =--> 'primary', 'menu_id' => 'primary-menu', 'menu_class' => apply_filters( 'thegem_nav_menu_class', 'nav-menu styled no-responsive' ), 'container' => false, 'walker' => new TheGem_Mega_Menu_Walker)); ?>
    <!--?php else : ?-->
        <!-- <?php echo'<h2>Display Blog Navigation Menu</h2>'; ?> -->
        <!--?php wp_nav_menu(array('theme_location' =--> 'primary', 'menu_id' => 'primary-menu', 'menu_class' => apply_filters( 'thegem_nav_menu_class', 'nav-menu styled no-responsive' ), 'container' => false, 'walker' => new TheGem_Mega_Menu_Walker)); ?>
    <!--?php endif; ?-->
    

    Many thanks

    otti


  •  7,095
    Oliver replied

    Hi,

    Here is the code example:

    function thegem_custom_wp_nav_menu_args($args) {
        if(in_array(get_the_ID(), array(11111))) {
            if($args['theme_location'] == 'primary') {
                $args['menu'] = 22222;
            }
        }
        return $args;
    }
    add_filter('wp_nav_menu_args', 'thegem_custom_wp_nav_menu_args');
    

    Where 11111 - page ID where you need to set one page menu.

    22222 - one page menu ID.

    Add this code to the functions.php of the child theme.

    Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. 

    Regards, Oliver

  • ottimoto replied

    Hi Gregor,

    It kind of works with the following code

    function thegem_custom_wp_nav_menu_args($args) {
        if(in_array(get_the_ID(), array(408))) {
            if($args['theme_location'] == 'primary') {
                $args['menu'] = 'back-for-good-blog-menu';
            }
        }
        return $args;
    }
    add_filter('wp_nav_menu_args', 'thegem_custom_wp_nav_menu_args');
    

    But the problem is that I will not have my logo in there, as per the usual navigation. What is missing is the following list item:

    <li class="menu-item-logo"><div class="site-logo" style="width:140px;">
        <a href="http://localhost:8888/1246_bfg/" rel="home">
                        <span class="logo"><img src="http://localhost:8888/1246_bfg/wp-content/uploads/thegem-logos/logo_41278171d5e3ff537db6e09a5b3db77b_1x.png" srcset="http://localhost:8888/1246_bfg/wp-content/uploads/thegem-logos/logo_41278171d5e3ff537db6e09a5b3db77b_1x.png 1x,http://localhost:8888/1246_bfg/wp-content/uploads/thegem-logos/logo_41278171d5e3ff537db6e09a5b3db77b_2x.png 2x,http://localhost:8888/1246_bfg/wp-content/uploads/thegem-logos/logo_41278171d5e3ff537db6e09a5b3db77b_3x.png 3x" alt="Back For Good" style="width:140px;" class="default"><img src="http://localhost:8888/1246_bfg/wp-content/uploads/thegem-logos/logo_996252d333a9ea45f87510a6251d52ba_1x.png" srcset="http://localhost:8888/1246_bfg/wp-content/uploads/thegem-logos/logo_996252d333a9ea45f87510a6251d52ba_1x.png 1x,http://localhost:8888/1246_bfg/wp-content/uploads/thegem-logos/logo_996252d333a9ea45f87510a6251d52ba_2x.png 2x,http://localhost:8888/1246_bfg/wp-content/uploads/thegem-logos/logo_996252d333a9ea45f87510a6251d52ba_3x.png 3x" alt="Back For Good" style="width: 68px; margin-right: 36px; margin-left: -104px; display: inline;" class="small"></span>
                </a>
    </div>
    </li>
    

    Can this be added somehow?

    Many thanks

    otti

  •  7,095
    Oliver replied

    Sorry, can't understand the problem by your code...

    Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. 

    Regards, Oliver

  •  7,095
    Oliver replied

    Can you add few screenshots? 

    Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. 

    Regards, Oliver

  • ottimoto replied

    Sure can.

    Attached is a screenshot for the header of the long scrolling page. You can see 4 navigation buttons and the centred logo. The navigation buttons direct to 4 areas on the long scrolling page. 

    The second screenshot shows a single blog post, after one blog teaser has been clicked on. The navigation only shows "Home", which is the only item as part of back-for-good-blog-menu. But I like my logo there in the center too.

  •  7,095
    Oliver replied

    Sorry, can't say you anything without the access.

    Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. 

    Regards, Oliver

  • ottimoto replied

    Ok. I try to upload in the next few days to show you. This is a vital point of that site, otherwise I will not be able to use The Gem.

    Many thanks

    otti

  •  7,095
    Oliver replied

    ok, let me know

    Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. 

    Regards, Oliver