WordPress.org

Support

Support » Plugins and Hacks » Hacks » Category & Custom Taxonomy based Breadcrumb

Category & Custom Taxonomy based Breadcrumb

  • Hi,

    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?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi there,

    Try checking out this plugin:

    Breadcrumb NavXT

    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.

    Moderator bcworkz

    @bcworkz

    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.

    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>"."
    						</span>";
    					}
    				}
    			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.

    Moderator bcworkz

    @bcworkz

    @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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Category & Custom Taxonomy based Breadcrumb’ is closed to new replies.
Skip to toolbar