WordPress.org

Support

Support » Themes and Templates » Second menu to specific page

Second menu to specific page

Viewing 3 replies - 1 through 3 (of 3 total)
  • first registered custom menu if you developed in functions.php
    for example:-
    //register the custom menus

    function register_my_menus() {
    register_nav_menus(
    array(
    'profile-menu' => __( 'Profile Menu' )
    'services-menu' => __( 'Services Menu' )
    )
    );
    }
    add_action( 'init', 'register_my_menus' );

    then on specific or desired page user this code for example:-

    <?php
    if (is_page('profile')){
    wp_nav_menu(array('menu'=>'profile-menu' ));
    } elseif (is_page('services')) {
    wp_nav_menu(array('menu'=>'services-menu' ));
    }

    ?>

    Is there any other way?
    Is seems like the theme won’t accept the function, and the editer f****s up.

    This line:
    function register_my_menus()

    It isnt in the theme function.php and when i add it the pages just turns all white.

    Thanks.

    this is the custom function for creating own custom menu, this is not wordpress function so editor don’t shows it 🙂

    <?php
    if (is_page('your specific page name')){
    wp_nav_menu(array('menu'=>'your desired menu to show up on the page' ));
    }
    ?>

    put this is code into appropriate template file which is responsible for the showing your specific code… have fun

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Second menu to specific page’ is closed to new replies.