Secondary menu


#1

Hi.... I want to display secondary menu instead of primary menu can you help me ??


#2

Hello Youthslife,

Its a three step process:

  1. De-register your primary menu function
  2. Call secondary menu function
  3. Append this function to respective hook.

Below is the code for above mentioned process. Paste the below code to functions.php file.

/* Remove Primary Menu */  
 function rtp_remove_menu() {  
 remove_action( 'rtp_hook_after_header','rtp_default_nav_menu' );  
 }  
 add_action( 'init', 'rtp_remove_menu' );
  
 /* Add Secondary Menu */  
 function rtp_custom_nav_menu() {  
 echo '';  
 if ( function_exists( 'wp_nav_menu' ) && has_nav_menu( 'secondary' ) ) {  
 wp_nav_menu( array( 'container' => '', 'menu_id' => 'rtp-nav-menu', 'theme_location' => 'secondary', 'depth' => apply_filters( 'rtp_nav_menu_depth', 4 ) ) );  
 } else {  
 echo '
    '; wp_list_pages( array( 'title_li' => '', 'sort_column' => 'menu_order', 'number' => '5', 'depth' => apply_filters( 'rtp_nav_menu_depth', 4 ) ) ); echo '
'; } echo '
'; } add_action( 'rtp_hook_after_header','rtp_custom_nav_menu' );

I hope it helps.

Cheers!!


#3