The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

category.php not working when category taxonomy is assigned to custom post type (5 posts)

  1. User Removed
    Posted 5 years ago #

    I assigned the category taxonomy to a custom post type but now the category.php template isnt displaying any of the custom post type posts.

    I have also tried to create a template named taxonomy-category.php but it does not work.

    I am dependent on having the category taxonomy assigned to this custom post type because I am using the "Category & Page I c o n s" plugin so the client is able to upload icons for each category item (this plugin only allows you to upload icons for the category taxonomy, and unfortunately not for custom taxonomies).

    Below is my category.php template code
    (I have also tried eliminating the query_posts function before the loop but it too does not work)

    <?php get_header(); ?>
        $postType = 'directory_entries';
        $postTypeName = 'Directory';
        $cat = get_query_var('cat');
        $category = get_category($cat);
      <h2 id="page_title" class="page_title"><?php print $category->name ?> Directory Entries <?php print $category->term_id ?></h2>
      <div id="<?php print $postType ?>" class="clearfix">
          <strong>In category.php template</strong>
          $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
                get_template_part( 'directory_entries', 'loop' );
      </div><!-- #<?php print $postType ?> -->
        <strong>Category var_dump:</strong><br /><pre><?php var_dump($category)?></pre>
      <?php get_search_form(); ?>
    <?php get_footer(); ?>
  2. Pedro Candeias
    Posted 5 years ago #

  3. User Removed
    Posted 5 years ago #

    I know how to use custom taxonomies. As explained above, I want to stick with using the category taxonomy because of the category term icon plugin im using....

  4. Pedro Candeias
    Posted 5 years ago #

    I'm sorry, i didn't understand at first. Can't help you.
    But, i would try to hack the plugin and make it support custom taxonomies.
    Good luck

  5. dolby_uk
    Posted 5 years ago #

    I have had the same issue. I'm still debugging it, however if I do a print_r($wp_query), it shows me that it's querying the posts post type, instead of all post types.

Topic Closed

This topic has been closed to new replies.

About this Topic