• Resolved agumba

    (@agumba)


    Hello, the home page on our site has been set up outside of wordpress. In the breadcrumb section, we want it to appear as the home page, Gotatil.com. If the WordPress Home Page is “Home”.

    How can I add something to the Code Snippet plugin?

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @agumba,

    Thank you for contacting Rank Math and bringing your concern to our attention.

    Please try adding the following filter to see if that works for you:
    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) { if ($crumbs[0][0] == 'Home' ) { $crumbs[0][1] = 'https://www.gotatil.com/'; } return $crumbs; }, 10, 2);

    Here’s how you can add filters/hooks to your WordPress site:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Let us know how it goes. Looking forward to helping you.

    Thread Starter agumba

    (@agumba)

    Hello,

    I turned off the theme’s own breadcrumb feature. Then I tried adding the code you gave through the plugin, but it didn’t work.

    The breadcrumb part is active in the plugin, but it never appeared.

    Thread Starter agumba

    (@agumba)

    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
        $homepage_link = 'https://example.com/';
        $homepage_title = 'Home';
        
        // add homepage link and title to the beginning of the crumbs array
        array_unshift($crumbs, array($homepage_title, $homepage_link));
        
        if ($crumbs[1][0] == 'Home' ) {
            $crumbs[1][1] = $homepage_link;
        }
        
        return $crumbs;
    }, 10, 2);
    
    add_action( 'TieLabs/before_archive_title', 'custom_breadcrumbs' );
    add_action( 'TieLabs/before_entry_head', 'custom_breadcrumbs' );
    
    function custom_breadcrumbs(){
        if ( function_exists('rank_math_the_breadcrumbs') ) {
            rank_math_the_breadcrumbs( '<nav id="breadcrumb">', '</nav>' );
        }
    }

    Hello, this is how I did it and it worked as I wanted. Thanks for your support, have a nice day.

    Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @agumba,

    We apologize for that.

    The filter code we previously shared will only work if you have already added our breadcrumbs code to your theme file which you can follow here: https://rankmath.com/kb/breadcrumbs/#theme-template-files

    Please ensure to add our breadcrumbs code first before applying the filter code we previously shared.

    Let us know how that goes.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Home Directory and Blog Breakdown’ is closed to new replies.