Skip Navigation

[Resolved] Yoast Breadcrumbs shortcode is not working for me

This support ticket is created 6 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 2 replies, has 2 voices.

Last updated by AtefR7377 6 years, 5 months ago.

Author
Posts
#901283

Hi,
I am trying to add the Yoast shortcode to my layouts.
i am using:

[yoast-breadcrumbs]

as per this page:
https://toolset.com/documentation/user-guides/views-shortcodes-for-other-plugins/
and this video tutorial from your team:
hidden link

However, when I paste this shorcode, whether in a layout, or directly in the content area, nothing happens at all.

I have Yoast installed, of course.

I tried this on a post, page and custom post. all don't show anything.

check this post as an example:
hidden link

#901290

We do solely provide a ShortCode for it, that's it (wp-views/embedded/inc/wpv-shortcodes.php, line 7538).

That ShortCode returns the native YOAST function yoast_breadcrumb().

add_shortcode('yoast-breadcrumbs', 'wpv_yoast_breadcrumbs');
function wpv_yoast_breadcrumbs($atts, $value){

	if ( function_exists('yoast_breadcrumb') ) {
		return yoast_breadcrumb("","",false);
	}

	return '';
}

The original function is in YOAST (wordpress-seo/inc/wpseo-functions.php, line 23):

if ( ! function_exists( 'yoast_breadcrumb' ) ) {
	/**
	 * Template tag for breadcrumbs.
	 *
	 * @param string $before  What to show before the breadcrumb.
	 * @param string $after   What to show after the breadcrumb.
	 * @param bool   $display Whether to display the breadcrumb (true) or return it (false).
	 *
	 * @return string
	 */
	function yoast_breadcrumb( $before = '', $after = '', $display = true ) {
		$breadcrumbs_enabled = current_theme_supports( 'yoast-seo-breadcrumbs' );
		if ( ! $breadcrumbs_enabled ) {
			$breadcrumbs_enabled = WPSEO_Options::get( 'breadcrumbs-enable', false );
		}

		if ( $breadcrumbs_enabled ) {
			return WPSEO_Breadcrumbs::breadcrumb( $before, $after, $display );
		}
	}
}

As we can see now, this works only if BreadCrumbs are enabled.
That seems to be done in Dashboard > SEO > Search Appearance > BreadCrumbs > Breadcrumbs settings
(Enabled/Disable).

As soon I activate that, I can insert the ShortCode [yoast-breadcrumbs] anywhere I want and it works.

#901351

Hi Beda,

sorry it was my mistake. i had the yoast breadcrumbs function turned off by mistake.
it is working good now.
thanks.