Integration Issue: Rank Math Breadcrumbs in Jannah Theme Causing Syntax

#1058586
  • Resolved eat It BIO
    Rank Math free

    Hello Rank Math Team,

    I hope you’re doing well.

    I’m using Rank Math SEO plugin on my website (https://aidalil.com) with the Jannah WordPress theme. I’ve enabled Breadcrumbs in Rank Math and I’m trying to integrate them globally across my website for SEO purposes and to fix a breadcrumb schema error reported by Google Search Console.

    The issue I’m facing:

    I enabled Breadcrumbs in Rank Math settings.

    I tried adding this code into my theme’s header.php file after the header section:

    When saving the file, I’m getting a PHP syntax error like:

    lua
    Copy
    Edit
    syntax error, unexpected ‘<‘, expecting end of file
    Because of this, the breadcrumbs don’t appear on my pages.

    Additionally, Google Search Console shows this error:

    Missing field “itemListElement” in BreadcrumbList schema.

    I tried different placements and variations of the code (using echo, PHP closing/opening tags, etc.), but it either causes syntax errors or breaks the layout.

    My goal:

    Integrate Rank Math breadcrumbs across all pages and posts in Jannah theme.

    Generate the proper JSON-LD schema including the itemListElement to fix the Search Console error.

    My questions:

    Is there a recommended or safer way to integrate Rank Math breadcrumbs into the Jannah theme?

    Should I use a specific hook or function rather than placing the code directly in header.php?

    Is there an alternative way to make sure the breadcrumbs schema is output properly on every page?

    Thanks a lot for your help!

    Best regards,

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

    We apologize for the issue you are facing with integrating Rank Math breadcrumbs into your Jannah theme. Thank you for providing detailed information about the problem.

    To integrate Rank Math breadcrumbs safely and effectively, we recommend the following steps:

    1. Use a Child Theme: If you haven’t already, consider using a child theme to make modifications. This prevents any changes from being lost during theme updates. You can find more information on creating a child theme here.

    2. Add Breadcrumbs Code: Instead of placing the breadcrumbs code directly in header.php, you can add it to your child theme’s template files. The recommended code to display breadcrumbs is:

      Place this code in the appropriate location within your child theme’s header.php or single.php file, depending on where you want the breadcrumbs to appear.

    3. Check for Syntax Errors: Ensure that you are not accidentally introducing syntax errors when editing the PHP files. Make sure that the PHP opening and closing tags are correctly placed, and there are no stray characters or HTML entities like &lt; in your code.

    4. Using Hooks: If you want to ensure that breadcrumbs are displayed across all pages without modifying template files directly, you can use WordPress hooks. For example, you can add the following code to your child theme’s functions.php file:

      add_action('wp_head', 'add_rank_math_breadcrumbs');
      function add_rank_math_breadcrumbs() {
         if (function_exists('rank_math_the_breadcrumbs')) {
             rank_math_the_breadcrumbs();
         }
      }

      This will automatically output the breadcrumbs in the head section of your site.

    5. Schema Validation: After implementing the breadcrumbs, check your website using Google’s Rich Results Test tool to ensure that the itemListElement property is included in the BreadcrumbList schema. This will help you confirm that the schema is being generated correctly.

    If you continue to experience issues or need further assistance, we recommend considering our professional setup service, which ensures that your Rank Math plugin is configured correctly according to the latest SEO standards. You can find more information about this service here.

    We hope this helps you resolve the issue with your breadcrumbs integration! If you have any further questions or need additional assistance, please feel free to reply to this ticket, and a human agent will assist you further.

    Best regards!

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

    Hello,

    Thank you for your query and we are so sorry about the trouble this must have caused.

    If your header.php file already contains a php tag inside, please make sure to remove the same from the code we provided to avoid a syntax issue. Please try the following code instead:

    
    if (function_exists('rank_math_the_breadcrumbs')) rank_math_the_breadcrumbs();

    As for the issue with the missing itemListElement, if the issue persists after successfully applying the code above, please share the affected URL here so we can take a closer look at it.

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

The ticket ‘Integration Issue: Rank Math Breadcrumbs in Jannah Theme Causing Syntax’ is closed to new replies.