• Resolved Ajeje Brazorf

    (@queued)


    Hello! I need to insert (%store%) tag inside Breadcrumbs structure.

    My product page URL page is: “site.com/%store%/%product_cat%/%product%”
    but Product Breadcrumbs is: Home > Product Category > Product

    I need: Home > (%store%) > Product Category > Product

    I activated and deactivated “Third party plugins – Breadcrumbs support” for Rank Math but not work.

    Thank you in advance.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Maciej Bis

    (@mbis)

    Hi @queued,

    As you have probably noticed, Permalink Manager by default does not support %store% permastructure tag. This applies also to the breadcrumbs filter.

    If you would like to add store name to Rank Math’s breacrumbs you will need to use one more code snippet:

    function pm_filter_rankmath_breadcrumbs($breadcrumbs) {
    	global $post;
    
    	if(count($breadcrumbs) > 1 && is_singular('product') && function_exists('dokan')) {
    		// Get Dokan store name
    		$vendor = dokan()->vendor->get($post->post_author);
    
    		if(empty($vendor)) {
    			return $breadcrumbs;
    		}
    
    		$new_breadcrumbs = array_slice($breadcrumbs, 0, 1);
    
    		$new_breadcrumbs = array_merge($new_breadcrumbs, array(array(
    			$vendor->get_shop_name(),
    			$vendor->get_shop_url()
    		)));
    
    		$new_breadcrumbs = array_merge($new_breadcrumbs, array_slice($breadcrumbs, 1));
    	}
    
    	return (!empty($new_breadcrumbs)) ? $new_breadcrumbs : $breadcrumbs;
    }
    add_filter('rank_math/frontend/breadcrumb/items', 'pm_filter_rankmath_breadcrumbs', 100);

    Best regards,
    Maciej

    Thread Starter Ajeje Brazorf

    (@queued)

    Hi @mbis!
    thank you very much for your amazing support! N°1

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change Breadcrumbs Structure’ is closed to new replies.