Support » Fixing WordPress » How to display the parent categories before the post title in a single page?

  • I’d like to have the categories displayed before the title of a post when in a single page.
    Like “Parent Category » Child Category » Post Title”. When I tried just using the get_category_parents function like:

    <span class="title">
    	<?php echo get_category_parents($cat, TRUE, ' » '); ?><?php the_title(); ?>
    </span>

    it didn’t work and I got the error “catchable fatal error: object of class wp_error could not be converted to string in /home/…/single.php on line 7”.

    Is there anyway to do that? Thanks.

  • The topic ‘How to display the parent categories before the post title in a single page?’ is closed to new replies.