I have a Custom Post Type set up with a Custom Taxonomy. For this Custom Taxonomy, I'm trying to figure out how to echo out the titles of the parent category and current child category within it.
This is the set-up:
prints (registered custom post type)
print_type (registered custom taxonomy)
- Prints & Note Cards (parent category in print_type taxonomy)
- Floral Prints (child category)
- Scenic Prints (child category)
- Note Cards (child category)
- Selection (child category)
On single-prints.php I would like to display (individually, not as a list):
Parent Category / Current Child Category / Post Title
None of that needs to be linked, I simply want the text in order to display the hierarchy. I've tried dozens of bits of code to display the two types of category titles without any luck.
I'm new to WP and PHP and I'm very frustrated since can't seem to wrap my head around what I'm doing that's wrong. Here's the page code:
<?php get_header(); ?>
<div id="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h2>
<?php
$category = get_the_category();
echo $category[0]->cat_name;
?>
</h2>
<h3><?php echo get_category_parents(19, TRUE, ' / '); ?><?php the_title(); ?></h3>
<p><?php the_excerpt(); ?></p>
<div id="workgrid" class="<?php the_ID(); ?>"><?php the_content(); ?></div>
<?php endwhile; endif; ?>
</div>
<!-- END CONTENT -->
<?php get_sidebar('prints'); ?>
<div class="clear"></div>