• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

How to add specific menu on a specific page or pages

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to add specific menu on a specific page or pages

This topic is: not resolved

Tagged: extra menu, specific page

  • This topic has 2 replies, 2 voices, and was last updated 5 years, 6 months ago by Konspaul.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • January 20, 2017 at 1:22 pm #199747
    Konspaul
    Member

    Hello,

    I'm looking for help on how to add specific menu on a specific page or pages with no plugin.

    I know how to add and register a new menu like this:

    
    //* Register third navigation menu position
    function register_additional_menu() {
      register_nav_menu( 'third-menu' ,__( 'Third Navigation Menu' ));
    }
    add_action( 'init', 'register_additional_menu' );
    add_action( 'genesis_before_content', 'add_third_nav_genesis' );
    
    function add_third_nav_genesis() {
    	echo'<div class="osastot-valikko">';
    	wp_nav_menu( array( 'theme_location' => 'third-menu', 'container_class' => 'genesis-nav-menu js-superfish sf-js-enabled sf-arrows' ) );
    	echo'</div>';
    }
    

    I would like to have a navigation menu named "Extra Menu" displayed only on three pages (post=6, post=7, post=8). What should I write in my function.php

    Thanks!

    January 20, 2017 at 1:25 pm #199748
    Victor Font
    Moderator

    See if this helps: https://victorfont.com/genesis-conditional-menus-revisited/


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    January 20, 2017 at 1:40 pm #199749
    Konspaul
    Member

    No really helping much, my PHP knowledge is not pass newbie level. Would you put something like this:

    
    //* Register extra menu position
    function register_additional_menu() {
      register_nav_menu( 'extra-menu' ,__( 'Extra Menu' ));
    }
    add_action( 'init', 'register_additional_menu' );
    add_action( 'genesis_entry_header', 'add_extra_menu_genesis' );
    
    function add_extra_menu_genesis() {
    	echo'<div class="extra-menu-class">';
    	wp_nav_menu( array( 'theme_location' => 'third-menu', 'container_class' => 'genesis-nav-menu js-superfish sf-js-enabled sf-arrows' ) );
    	echo'</div>';
    }
    
    function add_extra_menu_genesis( $args ) {
     
        if ( $args['theme_location'] == 'genesis_entry_header' ) {
            $args['menu'] = 'Extra Menu';
            if( is_page( 6 ) ) {
    	   echo'<div class="extra-menu-class">';
     	   wp_nav_menu( array( 'theme_location' => 'extra-menu', 'container_class' => 'genesis-nav-menu js-superfish sf-js-enabled sf-arrows' ) );
    	   echo'</div>';
            }
            if( is_page( 7 ) ) {
    	   echo'<div class="extra-menu-class">';
     	   wp_nav_menu( array( 'theme_location' => 'extra-menu', 'container_class' => 'genesis-nav-menu js-superfish sf-js-enabled sf-arrows' ) );
    	   echo'</div>';
            }
            if( is_page( 8 ) ) {
    	   echo'<div class="extra-menu-class">';
     	   wp_nav_menu( array( 'theme_location' => 'extra-menu', 'container_class' => 'genesis-nav-menu js-superfish sf-js-enabled sf-arrows' ) );
    	   echo'</div>';
            }
        }
        return $args;
    }
    
  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2022 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble