Custom Nav widget disappears when showing custom post type on archive pages
-
Hi there,
I’m having some trouble showing the Custom Navigation widget on archive pages.
My twenty twelve child theme has a custom post type that makes use of the regular post type categories. As I want my custom post type posts to appear on category archive pages I had to add the code below to my functions.php:
// add custom post type to category archive pages function namespace_add_custom_types( $query ) { if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) { $query->set( 'post_type', array( 'post', 'deelnemer', 'category' )); return $query; } } add_filter( 'pre_get_posts', 'namespace_add_custom_types' );
Now this piece of code is causing my Custom Navigation widget to disappear (at least, the links the widget generates disappear).
Any ideas what I could do to solve this in the cleanest possible way?
Thanks in advance!
- The topic ‘Custom Nav widget disappears when showing custom post type on archive pages’ is closed to new replies.