• Resolved scottcarlton

    (@scottcarlton)


    I have tried google searches as well as already posted forum topics, but haven’t been able to solve this issue.

    I have a custom post type of “Products” with custom taxonomy of
    “Product Types” that has 6 categories in it. The custom taxonomy both public and query_var are true.

    My product page (mywebsite.com/product-types/) displays my six categories, but when I click on a category (mywebsite.com/category/breadline/) the category.php displays “Nothing Found”.

    I tried the permalink reset and they are currently set at mywebsite.com/sample-post/.
    I’ve even tried to have it query the category directly with wp_query category_name with no luck.

    Any help would be great!

Viewing 1 replies (of 1 total)
  • Thread Starter scottcarlton

    (@scottcarlton)

    If anyone else is having this issue. This is how I resolved the issue.

    First – Custom Post Types and pages can’t have the same name. Example: My custom post type can’t be “Products” if my page is url/products.

    Second – I created my page.tpl.products.php file and placed the following code in it.

    $args = array( 'taxonomy' => 'product_category',
    							'hide_empty' => 0,
    							'parent' => 0 );
    
    			$terms = get_terms('product_category', $args);
    
        		$count = count($terms);
     if ( $count > 0 ){
         echo '<ul class="product-categories">';
         foreach ( $terms as $term ) {
           echo '<li class="clearfix"> <a href="/product-category/' . $term->slug . '" title="' . sprintf(__('View all post filed under %s', 'my_localization_domain'), $term->name) . '"><img src="https://placehold.it/75x75"><h3>'. $term->name . '</h3></a></li>';
    
         }
         echo '</ul>';
     }

    This listed my parent categories for my custom post type.

    Last – I created my taxonomy.php file to display my custom post types for that category.

    Hope this helps someone.

Viewing 1 replies (of 1 total)
  • The topic ‘Category "Nothing Found"’ is closed to new replies.