Adding custom post type to the loop – wp nav menu dissapears
-
Hello, after some search i found this usefull code to add my custom post type post into my category display, it works as expected, since im using the default categories with the custom post types. but i have a problem with the wp_nav_menu on every page i target the result. on this example im using is_category() and when i enter any category page the menu dissapears.im using a fresh install with the twentyten template.
add_filter( 'pre_get_posts', 'my_get_posts' ); function my_get_posts( $query ) { $post_types= get_post_types( array( '_builtin' => false ), 'objects' ); $array = array('post'); foreach($post_types as $type) array_push($array, $type->name); if ( is_category() ) $query->set( 'post_type', $array ); return $query; }
i would apreciate any help with this issue, thanks
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Adding custom post type to the loop – wp nav menu dissapears’ is closed to new replies.