Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

How to Display Custom Post Type on Category Archive Page WordPress

  • SOLVED

I'm a little stumped by this one, and I'm not quite sure where to turn, so I thought I would ask the question here.

I am using the Thesis theme for WordPress and have created a custom post type called "Folio" to display portfolio work. I have attached a general category (didn't create any new taxonomies for it) to it called "Portfolio".

However, when I go to the category archive page for "Portfolio", none of my custom posts show up. I need them to display on this page.

I'm not sure what all I need to include in here, so I will just include what I have in my custom_functions.php file for Thesis.


/* BEGIN Custom Post Type 'Folio' */
function create_folio() {
$folio_args = array(
'label' => __('Folio'),
'singular_label' => __('Folio'),
'public' => true,
'show_ui' => true,
'capability_type' => 'post',
'hierarchical' => false,
'query_var' => true,
'taxonomies' => array('post_tag', 'category'),
'rewrite' => array( 'slug' => 'folio', 'with_front' => false ),
'supports' => array('title', 'editor', 'thumbnail', 'custom-fields', 'comments', 'trackbacks', 'author')
);
register_post_type('folio', $folio_args);
}
add_action('init', 'create_folio');
/* END Custom Post Type 'Folio' */

/* BEGIN Adding Thesis Meta Boxes to 'Folio' */
add_action('admin_menu','my_admin_menu');
function my_admin_menu() {
$post_options = new thesis_post_options;
$post_options->meta_boxes();
foreach ($post_options->meta_boxes as $meta_name => $meta_box)
{
add_meta_box($meta_box['id'], $meta_box['title'], array('thesis_post_options', 'output_' . $meta_name . '_box'), 'folio', 'normal', 'high'); #wp
}
add_action('save_post', array('thesis_post_options', 'save_meta')); #wp
}
/* END Adding Thesis Meta Boxes to 'Folio' */

/* BEGIN Custom Columns for 'Folio' */
function folio_edit_columns($folio_columns){
$folio_columns = array(
"cb" => "<input type=\"checkbox\" />",
"title" => "Project Title",
"description" => "Description",
);
return $folio_columns;
}
function folio_columns_display($folio_columns){
switch ($folio_columns)
{
case "description":
the_excerpt();
break;
}
}
add_filter('manage_edit-folio_columns', 'folio_edit_columns');
add_action('manage_posts_custom_column', 'folio_columns_display');
/* END Custom Columns for 'Folio' */

/* BEGIN 'Folio' Post Queries */
function custom_page_type_folio() {
if (is_page('156', 'Folio')) { ?>
<?php
$loop = new WP_Query(array('post_type' => 'folio', 'posts_per_page' => 5));
?>
<div id="sidebars">
<?php thesis_build_sidebars(); ?>
</div>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div id="content" class="hfeed">
<div class="post_box top">
<div class="headline_area">
<h2 class="entry-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e('Permanent link to'); ?>"><?php the_title(); ?></a></h2>
</div>
<div class="format_text entry-content">
<?php $post_image = thesis_post_image_info('image'); ?>
<a href="<?php the_permalink() ?>"><?php echo $post_image['output']; ?></a>
<?php the_excerpt(); ?>
</div>
</div>
</div>
<?php endwhile; ?>
<?php }
}
remove_action('thesis_hook_custom_template', 'thesis_custom_template_sample');
add_action('thesis_hook_custom_template', 'custom_page_type_folio');
/* END 'Folio' Post Queries */


You can see what I am talking about here: [[LINK href="http://thomasgriffinmedia.com/category/portfolio/"]][[/LINK]]

My page that has my custom post types is here: [[LINK href="http://thomasgriffinmedia.com/folio/"]][[/LINK]]

Look forward to getting this question answered!

Answers (1)

2010-10-15

Pippin Williamson answers:

Custom post type archives aren't included in WordPress yet, but you can use a plugin:

[[LINK href="http://wordpress.org/extend/plugins/simple-custom-post-type-archives/"]]http://wordpress.org/extend/plugins/simple-custom-post-type-archives/[[/LINK]]


Thomas Griffin comments:

Seriously? Why would they leave out something important like this?

I'll just have to wait until a new release, then, cause I don't feel like customizing all of the stuff for Thesis. :-D


Pippin Williamson comments:

Yeah, dumb, I know.