How to select attributes displayed in breadcrumb ?

#425721
  • Resolved Ismaouste
    Rank Math free

    Hello there !

    I’ve been trying to display breadcrumb with the following structure :
    Home / BRAND / CATEGORY / Product title

    I tried 2 breadcrumbs, WooCommerce breadcrumbs gives me :
    Home / CATEGORY / Product title

    And RankMath breadcrumb gives me :
    Home / BRAND / Product title
    The brand is coming from the plugin Perfect Brands for WooCommerce, the brand product attribute can be accessed through the variable %pwb_brand%

    RankMath and WooCommerce breadcrumbs

    I’m trying to get
    Accueil / Tudor / Montres / Product Title…

    Surely there should be a way to get the best of the two, any ideas or suggestions ?

Viewing 1 replies (of 1 total)
  • Nigel
    Rank Math business

    Hello,

    Thank you for contacting Rank Math for help with customizing breadcrumbs display.

    You will need to create a custom filter code that edits the breadcrumbs based on your needs. You can refer to the following code snippet as a starting point:

    
    /**
     * Allow changing or removing the Breadcrumb items
     *
     * @param array       $crumbs The crumbs array.
     * @param Breadcrumbs $this   Current breadcrumb object.
     */
    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
    	return $crumbs;
    }, 10, 2);
    

    Hope that helps. Please let us know if you have questions.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘How to select attributes displayed in breadcrumb ?’ is closed to new replies.