ThemeShaper Forums » Thematic

[closed]

Custom Post Type Not Showing On Category Archives

(2 posts)
  • Started 12 years ago by jwpadgett
  • Latest reply from seanhawkridge
  • This topic is not resolved
  1. This is my first post to the forums, but I've already gleaned a great deal of help from you all. These forums are a great resource

    Initial Details:
    WP 3.2; Custom Post Type UI plugin; custom Thematic child theme

    The Problem:
    I've created a custom post type using the plugin and it displays fine when I view the post using single.php. In the setup of the CPT, I included support for categories and tags. The categories widget displays the categories, but when I click to view the category, none of my CPT posts are listed, but I do get the content header.

    Do I need to add anything to the category loop to show my posts?

    Posted 12 years ago #
  2. seanhawkridge
    Member

    You might need to override the category loop to include your custom post type. This might not be the most elegant solution (or it might be!) but it works for me:

    In your childtheme's functions.php

    function childtheme_override_category_loop() {

    global $query_string;
    parse_str($query_string, $args);
    $args['post_type'] = array('post','your-custom-post-type');
    query_posts( $args );

    while (have_posts()) : the_post();

    thematic_abovepost(); ?>

    <div id="post-<?php the_ID();
    echo '" ';
    if (!(THEMATIC_COMPATIBLE_POST_CLASS)) {
    post_class();
    echo '>';
    } else {
    echo 'class="';
    thematic_post_class();
    echo '">';
    }
    thematic_postheader(); ?>
    <div class="entry-content">
    <?php thematic_content(); ?>
    <?php echo slt_cf_field_value( 'itinerary' ); ?>

    </div><!-- .entry-content -->
    <?php thematic_postfooter(); ?>
    </div><!-- #post -->

    <?php

    thematic_belowpost();

    endwhile;
    }

    and change 'your-custom-post-type' to the name of your custom post type.

    Posted 12 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.