- This topic has 28 replies, 9 voices, and was last updated 6 years, 4 months ago by
David.
-
AuthorPosts
-
February 1, 2018 at 6:46 am #485350
James
Good morning Tom,
I have been reading through quite a few posts related to getting breadcrumbs on a GP site but it seems a little overwhelming as I do not know PHP and am fearful I will make a mistake.
It seems most references are made to the Yoast plugin which is what I use as well so that part is good.
I’ve seen some posts where the suggestion is to add some php code and others stating to add in the hooks section (I’ve most likely got the naming wrong apologies)
I’ve also seen comments like disable execution of php (I think that was it) and another stating to make sure execute PHP was checked.
Nonetheless what I would like to achieve is having breadcrumbs on my posts and pages (except home page) for a complete newbie who knows absolutely nothing about php code etc. what would you suggest as the easiest method for me to accomplish this?
I appreciate your feedback and support. Thanks as always.
February 1, 2018 at 9:27 am #485583Leo
StaffCustomer SupportHi there,
Yoast SEO would be the best option.
You can add it in using similar code here: https://generatepress.com/forums/topic/yoast-breadcrumbs-styling/#post-467121
Let me know if you need more info 🙂
February 5, 2018 at 11:20 am #488705James
Hi Leo I think this has worked itself out I need to do a few edits and double check prior to marking resolved. Thanks. This has lead me to two more questions but they’re not breadcrumb related so I will open a new thread on those topics:
Single Post Image Size
Meta Datathanks.
James
February 5, 2018 at 3:09 pm #488908Leo
StaffCustomer SupportNo problem 🙂
Sounds good!
February 5, 2018 at 10:53 pm #489107James
Leo it worked nicely thank you however it is also showing on all my pages and I’m hoping to only show the breadcrumbs on blog post pages is there something in the code I would need to add/change?
Thanks.
James
February 6, 2018 at 8:14 am #489535Leo
StaffCustomer SupportTry this:
<?php if ( function_exists('yoast_breadcrumb') && is_single() ) : ?> <div class="grid-container yoast-breadcrumb"> <?php yoast_breadcrumb( '<p id="breadcrumbs">','</p>' ); ?> </div> <?php endif; ?>February 6, 2018 at 8:53 am #489592James
This worked fantastically!!!
All pages including Home Page are no longer showing the breadcrumbs
HOWEVER
On my Blog main page they are still showing is there one more snippet I can add in that will remove it from the main blog page as well?
AND
I now have lost the breadcrumbs on the single blog posts themselves which is where I was hoping to have them appear?
JP
February 6, 2018 at 9:58 am #489680Leo
StaffCustomer SupportThe code I had before makes them ONLY show on blog page.
Just edited so they should ONLY show on single posts.
February 9, 2018 at 2:09 pm #492535James
Thanks Leo so the correct code to have the breadcrumbs only appear on single post pages is as you noted above and I’m copied below?
<?php if ( function_exists(‘yoast_breadcrumb’) && is_single() ) : ?>
<?php yoast_breadcrumb( ‘<p id=”breadcrumbs”>’,'</p>’ ); ?><?php endif; ?>
February 9, 2018 at 6:27 pm #492643Leo
StaffCustomer SupportYup the exact code here: https://generatepress.com/forums/topic/adding-breadcrumbs-to-gp/#post-489535
February 13, 2018 at 2:42 am #495051Kim
Hi Leo
I read this post with interest. Is there a code to just leave it out of the front page only?
Thanks
February 13, 2018 at 9:01 am #495415Leo
StaffCustomer SupportTry this:
<?php if ( function_exists('yoast_breadcrumb') && ! is_front_page() ) : ?> <div class="grid-container yoast-breadcrumb"> <?php yoast_breadcrumb( '<p id="breadcrumbs">','</p>' ); ?> </div> <?php endif; ?>More info here if you are interested: https://docs.generatepress.com/article/using-hooks-conditional-tags/
February 13, 2018 at 11:04 pm #495875Kim
Worked like a charm! Thank you very much 🙂
February 14, 2018 at 6:06 am #496075Leo
StaffCustomer SupportNo problem 🙂
June 10, 2018 at 10:11 pm #596945Simon
Leo,
Just a quick recap on how and where do I add this code you wrote? -
AuthorPosts
- You must be logged in to reply to this topic.