Tagged: breadcrumbs, Custom Post Type
How can we set breadcrumbs using assigned categories for custom post types?
any help is greatly appreciated!
Hey pixallus!
Are you trying to get the custom post type category to display in the breadcrumbs? If so then try this out, https://kriesi.at/support/topic/breadcrumbs-with-custom-post_types/.
Cheers!
Elliott
Yes, trying to get category to show in breadcrumb for CPTs.
Tried both options from your linked thread, but no luck :(
Hi!
Send us a WordPress login and set your reply as private and we’ll take a look.
Best regards,
Elliott
Hi!
Try opening up /enfold/framework/php/class-breadcrumbs.php and around line 306 you should see this.
if($post_type == 'portfolio')
{
$parents = get_the_term_list( $post_id, 'portfolio_entries', '', '$$$', '' );
$parents = explode('$$$',$parents);
foreach ($parents as $parent_item)
{
if($parent_item) $trail[] = $parent_item;
}
}
Try adding this beneath it.
if($post_type == 'article')
{
$parents = get_the_term_list( $post_id, 'article_taxonomy', '', '$$$', '' );
$parents = explode('$$$',$parents);
foreach ($parents as $parent_item)
{
if($parent_item) $trail[] = $parent_item;
}
}
And change “article_taxonomy” with whatever taxonomy you created.
Best regards,
Elliott