Archived topic
install yoast breadcrumbs
7 replies · Started by CRISTO on November 6, 2018
This is a pretty basic question, but I want to add yoast breadcrumbs. Here is the code they gave me:
<?php
if ( function_exists('yoast_breadcrumb') ) {
yoast_breadcrumb( '<p id="breadcrumbs">','</p>' );
}
?>
Can I just add this using custom css?
Hi there,
you can add the code to a Hook Element:
https://docs.generatepress.com/article/hooks-element-overview/
Make sure you check execute PHP in the Hook.
You can see what Hook to use on this visual guide:
Thanks, I have never used hooks before....and I saw this note on GP website: GP Hooks has been replaced by our Elements module.
so not sure where to go from here.
The link above explains. But... simply:
1. Go to Appearance > GeneratePress and ensure the Elements module is active.
2. Appearance > Elements > New Element > Hook.
3. Give the hook a title, add the code you have to the Content.
4. Select Hook: before_content
5. Check Execute PHP
6. Display Rules > Set Display Rule > Entire Site
You can change the position it displays by changing the Hook (point 4) to any of those listed in the visual guide above.
Thanks...I am almost there except at step 5 it says: Unable to execute PHP as DISALLOW_FILE_EDIT is defined.
OK, thats a server configuration, that would need you to follow the steps here:
https://codex.wordpress.org/Hardening_WordPress#Disable_File_Editing
If you're not comfortable with that then instead of adding the PHP snippet add the short code that is given here:
https://kb.yoast.com/kb/implement-wordpress-seo-breadcrumbs/
And instead of checking execute PHP, check Execute shortcode
Thanks, David. I took your advice and used the shortcode. It worked...finally understand what breadcrumbs are supposed to look like. Thanks for all your help.
You're welcome glad to be of help