Theme_location does not work
-
Hi!
I am trying to use 2 menus in one page(all pages), header and footer menu.
The problem is that my wordpress is broken or maybe I am. It does not work whatever I do, I have tried everything.This is the last I tried:
add_action( 'init', 'my_custom_menus' ); function my_custom_menus() { register_nav_menus( array( 'primary-menu' => __( 'Primary Menu' ), 'secondary-menu' => __( 'Secondary Menu' ) ) ); }
before that I used:
//register_nav_menu('huvudmeny', 'Headermeny'); //register_nav_menu('footermeny', 'Footermeny');
It get registered (both codes), I can see it in admin, appearance -> menus.
The problem is: I cannot show it on the page.
I use this in the Header:
<?php wp_nav_menu (array('theme_location' => 'primary-menu','menu_class' => 'nav'));?>
And this in the footer:
<?php wp_nav_menu (array('theme_location' => 'secondary-menu','menu_class' => 'nav'));?>
Nothing shows.
If I try:
<?php if ( has_nav_menu( 'primary-menu' ) ) echo 'primary-menu exists'; ?> <?php if ( has_nav_menu( 'secondary-menu' ) ) echo 'secondary-menu exists'; ?>
I got those messages, but still no menu.
What is wrong? pls find it, because I can’t
Thanks
- The topic ‘Theme_location does not work’ is closed to new replies.