WordPress.org

Ready to get started?Download WordPress

Forums

How to display the parent categories before the post title in a single page? (1 post)

  1. biellebrunner
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.