Hi.... I want to display secondary menu instead of primary menu can you help me ??
Hello Youthslife,
Its a three step process:
- De-register your primary menu function
- Call secondary menu function
- 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 '
I hope it helps.
Cheers!!