custom post type categories not visible

  • Author
    Posts
  • #33952
    sandras

    Thank you for beautiful Nirvana theme! I added 2 custom content type and realised that even if I use categories, it does not display those categories by default(http://mysite.com/category/my new category/) and I found from internet code which shall help to make it work, when added to function.php file. However I see that function file is different for Nirvana.. To which file shall I add that code? I`m using childtheme and I tried already to make new file function.php with code in below and placed that file under childtheme – did not help! btw. same code for another theme in function file made the work and categories were displayed. However I would like to proceed with nirvana. could you advice? here is the code:
    function add_custom_types_to_tax( $query ) {
    if( is_category() || is_tag() && empty( $query->query_vars[‘suppress_filters’] ) ) {

    // Get all your post types
    $post_types = get_post_types();

    $query->set( ‘post_type’, $post_types );
    return $query;
    }
    }
    add_filter( ‘pre_get_posts’, ‘add_custom_types_to_tax’ );

    #33953
    sandras

    sorry! Found my typing mistake in file, got it work!

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘custom post type categories not visible’ is closed to new replies.