Hi,
I am trying to add the Yoast shortcode to my layouts.
i am using:
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
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.
Hi Beda,
sorry it was my mistake. i had the yoast breadcrumbs function turned off by mistake.
it is working good now.
thanks.