breadcrumbs problem

#408269
  • Resolved Cemil
    Rank Math free

    Hello. I wanted to add “date” to rank math breadcrumbs. i did this but but the date is showing at the bottom. It should be the separator and after the title. I added a screenshot. How can I use this code correctly? What should be the correct code? Please help. thanks

    add_filter( ‘rank_math/frontend/breadcrumb/html’, function( $html, $crumbs, $class ) {
    $html = str_replace(‘<span class=”last”>’.get_the_title().'</span>’, ‘‘.get_the_title().’‘, $html) .get_the_date();

    return $html;
    }, 10, 3);

Viewing 3 replies - 1 through 3 (of 3 total)
  • Prabhat
    Rank Math agency

    Hello,

    Thank you for contacting the support.

    It is not recommended to add such elements to the breadcrumbs as breadcrumbs are specifically for navigation.

    However, if you still wish to add it, you can add the below filter to the website:

    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
    	$date = get_the_date();
    	array_splice( $crumbs, count($crumbs), 0, array(array(
    		$date
    	)) );
    	return $crumbs;
    }, 10, 2);

    Here’s how you can add the filter: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Let us know how that goes.

    Thank you.

    Cemil
    Rank Math free

    you are great, thanks.

    Prabhat
    Rank Math agency

    Hello,

    We are super happy that we could address your concern. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind us asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘breadcrumbs problem’ is closed to new replies.