Ready to get started?Download WordPress


Category & Custom Taxonomy based Breadcrumb (6 posts)

  1. Xcellence IT
    Posted 1 year ago #


    For a wordpress project on Single Post, I have an additional Custom Taxnomomy called 'topics' similar to category. On Single post page, I want to display breadcrumb like this...

    Home > Category_term > topics_term >

    Catgory term and topic term are the one that is attached to the post.

    Any idea how to get this done, using some plugin or custom function?

  2. Mohd Rafie
    Posted 1 year ago #

    Hi there,

    Try checking out this plugin:

    Breadcrumb NavXT

  3. Xcellence IT
    Posted 1 year ago #

    Hi, I tried with that unable to figure out how to configure it for this case... I think this kind of breadcrumb is not supported by this plugin.

  4. bcworkz
    Posted 1 year ago #

    A custom function shouldn't be too hard to build. Use wp_get_post_terms(), then sort the results based on the parent ID. Get more parent terms as needed until you reach the top. From that you can build a breadcrumb, including relevant links, for output to the client.

  5. shariffrb
    Posted 1 year ago #

    Hi, I have been search the forum and not able to fine exactly what I am looking for.

    $category = get_the_category();
    			if ($category) {
    				foreach($category as $category) {
    					$getcrumbs.= $separator . "<span typeof=\"v:Breadcrumb\">
    						<a rel=\"v:url\" property=\"v:title\" href=\"".get_category_link($category->term_id)."\" >$category->name</a>"."
    			echo $getcrumbs;

    the above shows the sub category first and the parent category at the last.

    I am try to figure out how get parent category first and then sub category.

  6. bcworkz
    Posted 1 year ago #

    @shariffrb: You don't want to have the same variable on both sides of 'as' in the foreach structure. Try changing the first 3 instances of $category to $categories. If the categories are coming out reversed from what you want, use $categories = array_reverse( $categories ); before the foreach line.

Topic Closed

This topic has been closed to new replies.

About this Topic