Hello,
I apologize for the issue you are facing with adding breadcrumbs using Google Tag Manager (GTM). Unfortunately, you cannot directly add PHP code like “ through GTM as it requires server-side processing.
To add breadcrumbs using GTM, you can follow these steps:
-
Using Rank Math Breadcrumbs Shortcode:
You can add the following shortcode [rank_math_breadcrumb]
directly in your post/page content within the WordPress editor. This will display the breadcrumbs on that specific post/page.
-
Adding Breadcrumbs in Theme Template Files:
If you want to add breadcrumbs to all pages using GTM, you can consider adding the breadcrumbs code directly to your theme’s template files. However, this method requires editing the theme files directly, which might be complex for beginners.
-
Customizing Breadcrumbs:
If you need to customize the breadcrumbs further beyond the default settings, you can refer to Rank Math’s guide on customizing breadcrumbs.
If you have any more questions or need further assistance, please feel free to ask. Thank you for reaching out for support!
Best Regards,
Rank Math Support Team
Sources:
How to Make Your Theme Rank Math Compatible » Rank Math
How to Enable Breadcrumbs on Your Website With Rank Math SEO » Rank Math
How to Customize Breadcrumbs in Rank Math » Rank Math
This is an automated reply from Rank Math Support Bot. Your ticket has been assigned to a human agent and we will get back to you shortly.
Hi
Thank you for your reply!
If I choose 2, and add the following to the theme file, which file and where should I add the code?
/**
* Use the following code in your theme template files to display breadcrumbs:
*/
<?php if (function_exists(‘rank_math_the_breadcrumbs’)) rank_math_the_breadcrumbs(); ?>
Header.php file?
Paste the code at the bottom works?
Best
Hello,
Thank you for contacting us and bringing your concern to our attention.
This PHP code is to display the Rank Math breadcrumbs at the front end of your website. You can add the code to your single.php/single-page.php or header.php file and make sure to add the PHP code on the body of the code, not in the <header>
or <footer>
tags.
Hope that helps and please don’t hesitate to let us know if you have any other questions.
Thank you.
Thank you for your kind support!
Hello,
We are glad that helped.
Can you please confirm if you still need our assistance with anything else or we can close the ticket?
Looking forward to hearing back from you.
Thank you.