Manual procedure to change breadcrumbs structure

Hello guys,

Did some research and got some elements to answer my question but I think it can be useful to other users if we can come up with a more straightforward way to alter the breadcrumbs element output.

We want to use Breadcrumbs with Custom Post Types and we often use URL Rewrites to get the appropriate URL structure in our CPTs.

For example, we have a a CPT “Creators” where the “archive” page is displayed on “site.com/creators” and individual Creator are displayed at “site.com/creator/john-doe”.

I have put “archive” between quotes because it’s not an actual archive page. We use a regular page with a shortcode to display a list of all Creators as it give us more control over the page layout. We then use URL Rewrite to ensure “/creator/” is added in the CPT permalink.

When using the breadcrumbs on the single-page for our CPT, the breadcrumbs will only display “Home > John Doe”, skipping the “Creators” page. Is there a way to add this?

Maybe a custom filter along the lines of…

add_filter( 'tc_edit_breadcrumbs' , 'my_custom_breadcrumbs_structure' );

function my_custom_breadcrumbs_structure {

    $current_post_type = $get_post_type($post);
    $customslug = array();

    if( $current_post_type == "creator" ) { 

        // Insert custom slug in breadcrumbs
        $customslug = array(
            "creators" => array(
                "target" => "https://www.site.com/creators/",
                "index"  => 1
            )
       );
    }

    return $customslug;

}

… or pushing the idea further you could expand the Breadcrumbs element to allow users to add arbitrary slugs at specific position, which would open some creative ideas using Dynamic Content.

Since I’m pretty sure there’s no such filter, what would be the best approach to achieve the desired result?

Thank you!

Hi @thisisbbc,

Thanks for writing in! Regretfully, this particular customization request is outside the scope of our support as this is not related to an issue with the theme and instead has to do with your customization of it. With that said, I have added this to our list of feature requests. This way it can be taken into consideration for future development. All of these items are discussed with our team internally and prioritized based on the amount of interest a particular feature might receive.

Thank you for your understanding

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.