-
Good day
I am using the Flatsome theme with Rank Math integration. Love Rank Math!!
I have a custom portfolio page set in Flatsome as /portfolio.
The breadcrumb path displays as “Portfolio (/featured_item/) > Portfolio Item Name”
(This has been overlooked by the Flatsome Devs…when using Rank Math breadcrumb shortcode, the custom Portfolio page is not written into the breadcrumb path).I have used the following filter in the functions file to rewrite /featured_item/ to my custom link.
add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) { $post_type = get_post_type(get_queried_object()); if ($post_type == 'featured_item') { $crumbs[1][0] = 'Portfolio'; $crumbs[1][1] = 'https://mydomain.com/portfolio'; // Change this on the live website to match the correct URL $crumbs[2][0] = get_the_title(); } return $crumbs; }, 10, 2);However, the breadcrumb now displays as:
“Portfolio (/featured_item/) > Portfolio (My custom link) > Portfolio Item Name”How do I remove the first “Portfolio (/featured_item/) >” so that only “Portfolio (My custom link) > Portfolio Item Name” displays?
Many thanks!!
You must be logged in to reply to this ticket.