Adding breadcrumb function code
-
Hello, I’m a rank Math SEO user and I wish to activate Rank Math’s Breadcrumb on my website. Is it possible to add Rank Math’s Breadcrumb function code using WPCode?
-
Hi @mikeyamon,
Yes, you can use WPCode to add the Rank Math breadcrumbs either using the PHP function using a PHP snippet in WPCode or using the shortcode in a Text snippet from WPCode.
You can then choose auto-insert locations to place the output of the snippet on your website.
If you need help getting started with WPCode snippets please take a look at this article: https://wpcode.com/docs/how-to-create-your-first-snippet/
Hello @gripgrip and thank you for your response. On the instertions>location, what should I select here? Should I select instert after content? I want Rank Math’s breadcrumb to displayed in the exact area where the original theme’s breadcrumb was displayed which was before the post.
Hi @mikeyamon,
You can try using the “Insert Before Post” location. Your theme is probably using a different location since the theme contains the actual template so you might not be able to replicate the location 100% with the auto-insert options available in the lite plugin.
Hi @mikeyamon,
Yes, in the premium version we have “Insert Anywhere” locations where you can use a CSS Selector to choose where a snippet is inserted without having to make changes to a template file.
If you would like to learn more about that please reach out using the form here: https://wpcode.com/contact/
Thank you very much @gripgrip for the explanation. What if I decide to add Rank Math’s function code on the Header Snippet just like how their documentation suggest on section 3.1. If I do that, will the code work?
Hi @mikeyamon,
Yes, you can use that code in PHP snippet in WPCode but it’s still a matter of where the snippet is inserted. The article suggest editing your theme files, with WPCode you should be able to avoid that by using the “Insert Before Post” location, for example.
Thanks @gripgrip for the explanation. I will put the code on the header field. But on the header field I also have Google Analytics code. Which code do you suggest should go first; should Rank Math’s code go first or Google Analytics code?
Hi @mikeyamon,
I don’t recommend putting the code in the header field as that is being output in the page <head> area which should only be used for scripts.
That’s why I suggested using the “Insert Before Content” location in a snippet.
Understood! I only have one concern regarding the suggestion that you gave me. If I put Rank Math’s code using the “Insert Before Content” location in a snippet; will the breadcrumb also appear on 404 error page and taxonomy?
Hi @mikeyamon,
You can easily add a new conditional logic rule in WPCode to limit loading the snippet only on single posts.
Enable conditional logic and choose Post Type for the type of rule from the “Where” category: https://a.supportally.com/i/eRbjHE
Adding the code to the Header will definitely load it on all pages.
Thank you very much for the excellent support. I have rated the plugin 5/5.
Thank you @mikeyamon 🙂
The topic ‘Adding breadcrumb function code’ is closed to new replies.