No menu on archive pages
-
Hi Chouby,
My category, page and custom menu widgets are not working (empty) on my archive pages (‘/cat/something/’) when I add the following in my function.php file://Add all post types add_action('pre_get_posts', 'my_posts'); function my_posts($query) { if (is_tag() || is_category()) { $qvars = $query->query_vars; $qvars['post_type'] = 'any'; $query->parse_query($qvars); } }
I’m not using the actual WP posts and I wanted to add my custom types (‘projects’) to the $query variable. I tried deactivating all plugins but yours and still the same issue happens.
If you’re wondering, I’m calling the menu that way:
<?php wp_nav_menu( array( 'container_class' => '', 'theme_location' => 'header-menu' ) ); ?>
I’m using the latest versions of WP (3.4.2) and polylang (0.9.2), any idea what’s happening there? Maybe there’s something wrong with my function?
Cheers,
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘No menu on archive pages’ is closed to new replies.