• Resolved Deranged_Dev

    (@deranged_dev)


    It says

    “Use the following code in your theme template files to display breadcrumbs:
    <?php if (function_exists(‘rank_math_the_breadcrumbs’)) rank_math_the_breadcrumbs(); ?>
    OR
    [rank_math_breadcrumb]”

    where to put it in my theme files? I tried custom css but it gave errors…

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello @deranged_dev,

    Thank you for contacting the support.

    You need to add the code in the functions.php of your theme.

    Not sure which theme you are using on your website but you can try the following code in the functions.php file (you can place it at the end):
    Use the following code to add Breadcrumbs above the content or below the title

    add_filter( 'the_title', function( $title ) {
      if( function_exists( 'rank_math_get_breadcrumbs' ) ) {
        $title .= rank_math_get_breadcrumbs();
      }
      return $title;
    });

    Above the content:

    add_filter( 'the_content', function( $content ) {
      if( function_exists( 'rank_math_get_breadcrumbs' ) ) {
        $content = rank_math_get_breadcrumbs() . $content;
      }
      return $content;
    });

    Hope that helps. Thank you.

    How about at top of page/post after headers and navigation.
    What would that functions code look like?

    Plugin Author Rank Math SEO

    (@rankmath)

    Hello @familyman82

    You will have to check if your theme provides any hook or filter to insert the code at a specific location.

    You can also use the_title or the_content filter to add Breadcrumbs below the title or above the content.

    Hope that helps. Thank you.

    P.S. Always open a new support topic instead of replying on someone’s else topic. That is not a preferred method to seek help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Where to put breadcrumbs code’ is closed to new replies.