Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I solved the problem with the page, the correct answer is ptriek's comment below.

Well I'm having a bit of an odd problem here, wp_nav_menu works on all pages EXCEPT my category pages (probably my archive page too but there's no links on the website to the archive pages so that's alright).

Although there is archive.php in my theme files, this controls what is displayed on category, tag, archive, author, etc. pages.

I just don't understand why, since every page uses the same header.php to display wp_nav_menu, it won't show up for the category pages.

Am I overlooking something? I've been banging my head against my keyboard trying to figure this out and it just won't work!

Using a very simple code: <?php wp_nav_menu('container_class=menu-header&theme_location=primary'); ?>

share|improve this question
1  
you could have look on wordpress.org/support/topic/… - see solution at the bottom (haven't tested it though) –  ptriek Dec 1 '11 at 13:56
    
That actually works, nice! Thanks. –  Jared Dec 1 '11 at 14:01

3 Answers 3

I had the same problem, but with a newer version of Wordpress (3.7.1).

On pages with custom taxonomies of custom posts, the wp_nav_menu was not shown. The solution below worked for me.

in functions.php of the theme:

add_action( 'pre_get_posts', 'my_pre_get_posts' );
function my_pre_get_posts($query) {
  if ($query->get('post_type') === 'nav_menu_item') {
    $query->set('tax_query','');
  }
}
share|improve this answer

Implode's answer is right and helped me a lot. I tried to implement a hook (pre_get_posts) for avoiding to display posts of subcategories. My hook worked well despite of no more Nav-Menus.

So, when change the tax_query you have to avoid doing this for the query with post_type == 'nav_menu_item'.

share|improve this answer
up vote 0 down vote accepted

This question was answered by ptriek, a shame he didn't post his answer so I could accept it, but for the sake of completeness I will answer it. The solution was found here:

http://wordpress.org/support/topic/wp-nav-menu-dissapears-in-category-pages-1

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.