• Resolved WorthyWP

    (@worthywp)


    Hello,

    I’m interested in using your plugin, but I’m used to running breadcrumbs as links within my theme. Is this possible with this plugin? If so, how would I implement it?

    Thanks,

    Worthy

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @worthywp, can you tell me what it means “breadcrumbs as links”? You mean, you want to have clickable links for breadcrumbs in your posts?

    As always (if possible), tell us what theme you are using, URL to your website is also good, or tell us how are your breadcrumbs set up. That way we can be more of help. ??

    As far as I know, in TSF breadcrumbs are not physically added to your website, since this is more of a theme territory, not as much plugin territory. But the breadcrumb output is there with TSF but it is not visible as “links”.

    Maybe you want something like yoast implementation of breadcrumbs, is that it? Thanks for clarification!

    Thread Starter WorthyWP

    (@worthywp)

    So basically I put into my functions.php file —

    function convertBreadcrumbsToMicrodata($breadcrumbs)
    {
    // remove the XML namespace
    $breadcrumbs = str_replace(‘ xmlns:v=”https://rdf.data-vocabulary.org/#”‘, ”, $breadcrumbs);
    // convert each breadcrumb
    $breadcrumbs = preg_replace(
    ‘/<span typeof=”v:Breadcrumb”>([^<]+)<\\/a><\\/span>/’,
    ‘<span itemscope itemtype=”
    https://data-vocabulary.org/Breadcrumb”&gt;<span itemprop=”title”>$2</span></span>’,
    $breadcrumbs
    );
    $breadcrumbs = preg_replace(
    ‘/<span typeof=”v:Breadcrumb”><span class=”breadcrumb_last” property=”v:title”>([^<]+)<\\/span><\\/span>/’,
    ‘<span itemscope itemtype=”https://data-vocabulary.org/Breadcrumb”><span class=”breadcrumb_last” itemprop=”title”>$1</span></span>’,
    $breadcrumbs
    );
    return $breadcrumbs;
    }
    add_filter(‘wpseo_breadcrumb_output’, ‘convertBreadcrumbsToMicrodata’);

    In my theme file I added this to output the breadcrumbs as links —

    <?php if ( function_exists( ‘yoast_breadcrumb’ ) ) {
    yoast_breadcrumb();
    } ?>

    That gives me a set of breadcrumb links such as —

    Home >> Category >> Page

    Thanks,

    Worthy

    Plugin Author Sybre Waaijer

    (@cybr)

    Hi @worthywp,

    The SEO Framework’s breadcrumbs are brought through Schema.org JSON-LD structured data. In such a way, that only robots consume it. This means that visitors won’t see the breadcrumbs on your website; unless they browse the source.

    Now, I suggest refraining from adding your own visible breadcrumbs script. It’s very complicated and also high-maintenance. For this, I suggest using a plugin like Breadcrumb NavXT which allows for easier implementation.

    Note that the previously suggested implementation won’t work with either of The SEO Framework nor Breadcrumb NavXT.

    P.S. in the future, you should use backticks (`) to encapsulate code on these forums.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add Breadcrumbs to Theme’ is closed to new replies.