-
Author
-
April 28, 2015 at 09:29 #56411dolphspeed99Participant
Hello,
I need to replace the theme’s breadcrumbs with the breadcrumbs from WordPress SEO by Yoast plugin. I can’t really replace them in function-breadcrumbs.php so I was wondering where exactly should I make the replacement? I also tried replacing them in the general-title-section.php but all I get are errors on frontend. I can hide the default breadcrumbs with CSS but I need to know where exactly to insert the code
<?php if ( function_exists(‘yoast_breadcrumb’) ) {
yoast_breadcrumb(‘<p id=”breadcrumbs”>’,'</p>’);
} ?>so that it appears in the same place where your breadcrumbs appear, which is setup to be in the right side of the title bar.
Thank you!
April 28, 2015 at 17:34 #56457sharmstrModeratorWhy can’t you just override the kleo_breadcrumb function? Something like this in your functions.php file.
COPY CODEfunction kleo_breadcrumb( $args = array() ) { return yoast_breadcrumb('<p id="breadcrumbs">','</p>'); }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
April 28, 2015 at 22:07 #56488dolphspeed99ParticipantI added the code in the functions.php and the Yoast breadcrumbs appear, but in a wrong position. They appear on top of the main title section and I need them inside the main title section, in the same position where your breadcrumbs are (text-align: right in the section.main-title). And your breadcrumbs were replaced by number “1” … how come? Please take a look at the printscreen.
Attachments:
You must be logged in to view attached files.April 28, 2015 at 23:14 #56493sharmstrModeratorThat’s probably because the yoast_breadcrumb function does an echo which will print out the breadcrumb right when its called instead of waiting for when kleo triggers the display. Looks like you can easily override that though. Also, try wrapping it in a div with the “kleo_framework breadcrumb” classes. See what happens when I change the code up a bit
COPY CODEfunction kleo_breadcrumb( $args = array() ) { return '<div class="kleo_framework breadcrumb">This doesnt echo</div>'; }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
Attachments:
You must be logged in to view attached files.April 29, 2015 at 01:09 #56525sharmstrModeratorI was right. It was an echo’ing issue. Do this
COPY CODEfunction kleo_breadcrumb( $args = array() ) { return WPSEO_Breadcrumbs::breadcrumb( '<div class="kleo_framework breadcrumb">', $after, '</div>' ); }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
June 29, 2015 at 15:34 #65474virtualtopiaParticipantI have the same idea. The Kleo breadcrumb line is not working that well for me as you can see here for example.
http://www.smartcountries.com/location/oceania/new-zealand/new-zealand-photos/queenstown/The hierarchy is out of whack. It should be:
Home / AUSTRALIA | OCEANIA / New Zealand / New Zealand Photos / QueenstownAlso I would like to show the category hierarchy for each post in the breadcrumb line. I think Yoast supports that.
I followed your solution above, but am confused.
I have a child-theme. Can I post the above code there, (it didn’t work when I tried).
If so, exactly what code can I place there if any?
Thanks.
June 29, 2015 at 15:57 #65478sharmstrModeratorPut it in your functions.php file located in your child theme. This code: https://archived.seventhqueen.com/forums/topic/change-breadcrumbs/#post-56525
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
June 30, 2015 at 04:41 #65681virtualtopiaParticipantGreat that worked. Although I really thought I did that yesterday at one point before changing back. Could have been fighting cache.
Cheers.
April 3, 2016 at 11:24 #114277markob17ParticipantHi @sharmstr, I’m trying to figure out how to make your code below only change the breadcrumbs on posts. I want all other pages to use Kleo breadcrumbs. Is this possible? I tried an if statement using is_single() but doesn’t work for me. My coding experience is limited so I’m not sure what else to try. Thanks for your help.
COPY CODEfunction kleo_breadcrumb( $args = array() ) { return WPSEO_Breadcrumbs::breadcrumb( '<div class="kleo_framework breadcrumb">', $after, '</div>' ); }
Regards,
Mark -
AuthorPosts
The forum ‘KLEO’ is closed to new topics and replies.