سؤال

I am using the Yoast SEO Wordpress plugin and am implementing breadcrumbs on my site for some reason I have 2 issues I cannot seem to resolve.

  1. After adding the following code a number '1' shows up and I cannot get rid of it... See http://alanbrandt.com/portfolio/

  2. All pages have the same post name part from the posts root site? Why does it always show the same post title on all pages? (Home > Portfolio > Daydreaming…)

Here is the code:

<div class="breadcrumbs">
    <?php 
    if ( function_exists('yoast_breadcrumb') ) {
        $breadcrumbs = yoast_breadcrumb('<p class="breadcrumbs_p">','</p>');
        echo $breadcrumbs;
    } 
    ?>
    </div>
    <div class="clearfix"></div>

Hope some one can help!

Thanks! :)

هل كانت مفيدة؟

المحلول

From the source

/**
  * Template tag for breadcrumbs.
  *
  * @param string $before  What to show before the breadcrum
  * @param string $after   What to show after the breadcrumb.
  * @param bool   $display Whether to display the breadcrumb (true) or return it (false).
  * @return string
  */

You want to do:

$breadcrumbs = yoast_breadcrumb('<p class="breadcrumbs_p">','</p>', false);

or do the following and not echo.

yoast_breadcrumb('<p class="breadcrumbs_p">','</p>');
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top