Issues with breadcrumb.

#982974
  • Resolved Twan Zwart
    Rank Math free

    Hey there, we’re building our site from the ground up and I’m having some issues with Rank Math’s breadcrumbs on our test site new.laagst.nl.

    I’m displaying the breadcrumb with the php code that is shown on Rank Math’s breadcrumb settings page and that works, but I’m running into some issues.

    The issue’s I’m having:
    1. I’m trying to hide the custom taxonomy in the breadcrumb. It’s “Producten” as you can see via this link. No, it’s not Woocommerce products. We used it in the past and that’s why we’re using “product” and “product_cat”. I tried disabling “Hide taxonomy name” in the settings for Products but that didn’t seem to work.
    Rank Math
    2. Secondly I’m trying to change the seperators to svg chevron icons and display a house svg in front of the homepage link. Both not working by adding below example code to functions.php: https://pastebin.com/ixNnd8At

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hello,

    We apologize for the issues you’re facing with the breadcrumbs on your test site. Thank you for providing detailed information about the problems.

    1. Hiding Custom Taxonomy

    To hide the custom taxonomy name in the breadcrumbs, ensure that the Hide Taxonomy Name option is enabled in the Rank Math settings. If it’s not working as expected, please double-check that there are no other plugins or theme settings that might be overriding this option. Additionally, make sure that you have cleared any caching on your site after making changes to the settings.

    2. Changing Separators and Homepage Link

    For changing the separators to SVG chevron icons and displaying a house SVG in front of the homepage link, you can use the filters provided by Rank Math. The code you shared from Pastebin should work, but ensure that you are correctly implementing it in your functions.php file. Here’s a brief overview of how to do it:

    add_filter('rank_math/frontend/breadcrumb/settings', function ($settings) {
        $settings['separator'] = 'your_svg_chevron_code'; // Replace with your SVG code
        return $settings;
    });
    
    add_filter('rank_math/frontend/breadcrumb/strings', function ($strings) {
        $strings['home'] = 'your_svg_house_code'; // Replace with your SVG code
        return $strings;
    });

    Make sure to replace your_svg_chevron_code and your_svg_house_code with the actual SVG code you want to use.

    If these adjustments still do not resolve your issues, please reply to this ticket with any error messages or additional details, and a human agent from our support team will assist you further.

    Thank you for your patience, and we look forward to helping you get this sorted out!

    Sources:
    How to Enable Breadcrumbs on Your Website With Rank Math SEO » Rank Math
    How to Make Your Theme Rank Math Compatible » Rank Math

    1. So with below code it does show the chevron but I don’t want it to show as a chevron.

    add_filter('rank_math/frontend/breadcrumb/settings', function ($settings) {
        $settings['separator'] = '<img src="https://new.laagst.nl/wp-content/uploads/svg/chevron-right.svg" width="16" height="16">';
        return $settings;
    });

    2. House icon is not working and should be displayed in front of the text “Aanbiedingen”
    3. The setting to disable “Producten” text doesn’t work.

    “1. So with below code it does show the chevron but I don’t want it to show as a chevron.”

    I mean: So with below code it does show the chevron but I don’t want it to display as an image.

    Btw not sure why it says I have the free Rank math version. I have the PRO version.

    Hello,

    Thank you for your patience.

    You mentioned that you’re using Rank Math PRO, but the account you have used to open this ticket is the Rank Math free version.

    Can you please search and forward a receipt from FastSpring.com or the email address you used to purchase so we can locate your account and verify it?

    Regarding your concern, you may use this filter to remove the “Producten” from your single product pages:

    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
        if( is_product()) {
    			unset($crumbs[1]);
            $crumbs[1] = [
    				$category->name,
    				site_url( $category->slug ),
    				'hide_in_schema' => false,
    			];
    		return $crumbs; 
        }
        return $crumbs;
    }, 10, 2); 

    For the breadcrumbs home icon, the SVG image you shared is for the separator.

    However, you can use and customize this filter to add the icon before the “Home” crumbs:

    add_filter( 'rank_math/frontend/breadcrumb/html', function( $html, $crumbs, $class ) {
    	$html = str_replace( 'Home', '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-house-fill" viewBox="0 0 16 16">
      <path fill-rule="evenodd" d="m8 3.293 6 6V13.5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 13.5V9.293l6-6zm5-.793V6l-2-2V2.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5z"/>
      <path fill-rule="evenodd" d="M7.293 1.5a1 1 0 0 1 1.414 0l6.647 6.646a.5.5 0 0 1-.708.708L8 2.207 1.354 8.854a.5.5 0 1 1-.708-.708L7.293 1.5z"/>
    </svg> Home', $html );
    	return $html;
    }, 10, 3);

    The icon is from this link:
    https://icons.getbootstrap.com/icons/house-fill/

    Hope that helps.

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Both codes are added to functions.php. The house svg is showing, but the other script to hide the taxonomy is throwing an error page on pages with the breadcrumb. I will add admin access via sensitive data.

    Thanks!

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,

    This “Producten” page seems to be a general archive for your custom post type called “product”.

    Please try the following code instead:

    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
    	if (get_post_type() === 'product') {
    		for ($i=0; $i < count($crumbs); $i++){
    			if(strtolower($crumbs[$i][0]) == 'producten'){
    				unset($crumbs[$i]);
    			}
    		}
    		$crumbs = array_values($crumbs);
    	}
    	
    	return $crumbs;
    }, 10, 2);

    Let us know how that goes.

    Looking forward to helping you.

    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 9 replies - 1 through 9 (of 9 total)

The ticket ‘Issues with breadcrumb.’ is closed to new replies.