This topic has 9 replies, 4 voices, and was last updated 8 years by markob17.

  • Author
  • #56411
     dolphspeed99
    Participant

    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!

    #56457
     sharmstr
    Moderator

    Why can’t you just override the kleo_breadcrumb function? Something like this in your functions.php file.

    COPY CODE
    
    function 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 solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #56488
     dolphspeed99
    Participant

    I 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.
    #56493
     sharmstr
    Moderator

    That’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 CODE
    
    function 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 solution

    This 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.
    #56525
     sharmstr
    Moderator

    I was right. It was an echo’ing issue. Do this

    COPY CODE
    
    function 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 solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #56570
     dolphspeed99
    Participant

    It is working great now, thank you so much.

    #65474
     virtualtopia
    Participant

    I 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 / Queenstown

    Also 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.

    #65478
     sharmstr
    Moderator

    Put 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 solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #65681
     virtualtopia
    Participant

    Great that worked. Although I really thought I did that yesterday at one point before changing back. Could have been fighting cache.

    Cheers.

    #114277
     markob17
    Participant

    Hi @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 CODE
    
    function kleo_breadcrumb( $args = array() )
        {
            return WPSEO_Breadcrumbs::breadcrumb( '<div class="kleo_framework breadcrumb">', $after, '</div>' );
        }
    

    Regards,
    Mark

Viewing 10 posts - 1 through 10 (of 10 total)

The forum ‘KLEO’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?