Breadcrumb functionality seems limited

#2108
  • Resolved BLMMedia
    Rank Math free

    Have been using Yoast for many years like most people, never been that impressed with it, stumbled onto RankMath and it seemed pretty amazing – so, my point being is I have just installed it on my first site and have been going through the setup and changing things over from using Yoast.

    First problem I have come across is with the breadcrumbs – whilst the options in the admin section are very good, developer wise, thew function that generates them, not so good.

    For example, this was my current setup with Yoast:

    if (function_exists('yoast_breadcrumb')) {
    	$breadcrumbs = yoast_breadcrumb( '<p id="breadcrumbs">','</p>', false );
    	$data['breadcrumbs'] = ($breadcrumbs) ? $breadcrumbs : false;
    }

    I do it the above way because I use the Twig templating system and I am setting the breadcrumbs inside my functions.php file in a section that makes them globally available to Twig as breadcrumbs.

    As you can see I was using a surrounding container and was also able to tell Yoast to not echo the content, rather return it.

    I checked out the rank_math_the_breadcrumbs function and it seems returning it is a no go as echo’ing it is hardcoded in, and am unsure if you can pass any other args to it such as using a surrounding container – I see it takes a $args array, but there doesn’t seem to be much documentation around what these args are?

    I was hoping for a smooth transition, but unfortunately it doesn’t seem to be the way πŸ™

    On a more positive note, I do love what I have seen from the plugin outside of this, you guys have done great work, just wish it was a bit more developer friendly.

    • This topic was modified 5 years ago by BLMMedia.
Viewing 15 replies - 1 through 15 (of 16 total)
  • BLMMedia
    Rank Math free

    Ok, just noticed another major issue (at least for me).

    In Yoast they allowed, and I was using HTML in my Separator Character and Homepage Label; however with RM it gets stripped out if I enter any HTML there.

    Not being able to use HTML in there really ruins the design; don’t really want to have to inject code with JS or use CSS hackery. πŸ™

    Michael Davis
    Rank Math pro

    Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    I have just raised this issue with our developers and we will be looking into this further and then get back to you.

    Looking forward to helping you. Thank you.

    ​​​​​​​

    BLMMedia
    Rank Math free

    Hi Michael,

    Thanks very much for the prompt response – look forward to hearing what the devs say.

    Cheers!

    Todd
    Rank Math free

    Hey,

    Have you tried one of these filters:
    https://rankmath.com/kb/filters-hooks-api-developer/#breadcrumbs

    Hopefully, this should suffice. Please let me know if it doesn’t work the way you intend it to.

    Thank you.

    BLMMedia
    Rank Math free

    Hi Todd – thanks for the response.

    Checked that link out, they look like they do what I need, but tried the first two and neither worked – had no effect at all. Not sure why.

    Hello,

    Please find below answers to your questions:

    First problem I have come across is with the breadcrumbs – whilst the options in the admin section are very good, developer wise, thew function that generates them, not so good.

    Instead of using rank_math_the_breadcrumbs function, please use rank_math_get_breadcrumbs() this function returns the breadcrumb data.

    I checked out the rank_math_the_breadcrumbs function and it seems returning it is a no go as echo’ing it is hardcoded in, and am unsure if you can pass any other args to it such as using a surrounding container – I see it takes a $args array, but there doesn’t seem to be much documentation around what these args are?

    You can use below filter to change the wrapper element surronding the Breadcrumbs: https://rankmath.com/kb/filters-hooks-api-developer/#change-breadcrumb-args

    Checked that link out, they look like they do what I need, but tried the first two and neither worked – had no effect at all. Not sure why.

    Can you share your login details in the Sensitive Data Section so we can take a look at the issue on your site and fix it for you?

    Looking forward to helping you. Thank you.

    BLMMedia
    Rank Math free

    Instead of using rank_math_the_breadcrumbs function, please use rank_math_get_breadcrumbs() this function returns the breadcrumb data.

    Ahh, thanks for that. I’m an idiot, I should have noticed that when looking at the code haha..

    Can you share your login details in the Sensitive Data Section so we can take a look at the issue on your site and fix it for you?

    I will add the info to the sensitive data section. Thanks! πŸ™‚

    Hello,

    I wanted to take a look at the issue but I couldn’t login with the provided access details. Can you please check and provide the correct username and password?

    Looking forward to helping you. Thank you.

    BLMMedia
    Rank Math free

    Hmmm… not sure what happened there. I have updated the password and confirmed it is working.

    Thanks!

    BLMMedia
    Rank Math free

    Were you able to get in to have a look?

    Thanks!

    Hello,

    Sorry for not following up quickly.
    To change the Breadcrumb wrapper, you can pass the value in rank_math_get_breadcrumbs function and in Settings, you will find an option to change the Homepage label which seems to be working fine on your site.

    Following is the argument array you can pass in rank_math_get_breadcrumbs function:

    
    if ( function_exists('rank_math_get_breadcrumbs') ) {
          $args = [
            'wrap_before' => '<nav class="rank-math-breadcrumb"><p>',
            'wrap_after'  => '</p></nav>',
            'before'      => '',
            'after'       => '',
          ];
        echo rank_math_get_breadcrumbs( $args ); 
    }
    

    Hope that helps. Thank you.

    • This reply was modified 5 years ago by Pratik.
    BLMMedia
    Rank Math free

    Hello Patrick,

    The main things I need to change are the Separator Character and Homepage Label and as stated above doing it in admin doesn’t work as it strips out html characters.

    As you can see in my functions.php file I am trying to change these but it is not working.

    add_filter( 'rank_math/frontend/breadcrumb/strings', 'blm_modify_breadcrumb_strings', 10, 1);

    function blm_modify_breadcrumb_strings( $strings ) {
    	$strings = array(
    		'prefix'         => 'rrrr',
    		'home'           => 'tttttt',
    		'error404'       => '',
    		'archive_format' => '',
    		'search_format'  => '',
    	);
    	return $strings;
    }

    That was just for testing purposes, I also tried using rank_math/frontend/breadcrumb/settings to change the separator, but that didn’t work either.

    Please advise.

    Thanks!

    BLMMedia
    Rank Math free

    Can someone please help me get this issue fixed? This site has to launch soon and I am still trying to fix the breadcrumbs since changing over to RankMath.

    Michael Davis
    Rank Math pro

    Hi there,

    Apologies for the huge delay.

    I have just been notified that our developers have been able to patch this and the fix will be available in the next update which will be released soon.

    We appreciate your patience.

    BLMMedia
    Rank Math free

    Thanks very much Michael. πŸ™‚

Viewing 15 replies - 1 through 15 (of 16 total)

The ticket ‘Breadcrumb functionality seems limited’ is closed to new replies.