On a custom category template, I've got it listing all sub-categories using get_category.
What I need to add is to get content from a custom post type, in that same sub-category. Something like:
- get sub-category (foo)
- now, is there a post in category-content (a custom post type) in that same (sub)category (foo)?
- show this sub category title, content from the custom post type, and link to the subcategory page
- rinse and repeat for each sub-category
Got it!
[Code moderated as per the Forum Rules. Please use the pastebin]
Used this on a custom template for this (parent) category.
I needed more info for a category than description allows. I set up a custom post type to hold the info each category needed, including special fields.
It isn't long.
<?php $args=array('category_name' => 'mycategoryname' , 'post_type' => 'mycustomposttypename',);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<h1><?php the_title(); ?></h1>
<?php endwhile; }
wp_reset_query(); ?>
If you have trouble put the last ?> on it's own line.