Archived topic
Breadcrumb Shortcode
6 replies · Started by Eric on September 11, 2020
Hi,
I use your shortcode structure to make a shortcode for Breadcrumb nav XT
to display it in hook element for blog post but shortcode returns nothing, no breadcrumb after ‘You are here' :(
Thanks for your help
add_shortcode( 'breadcrumb', function() {
ob_start();
// Start your PHP below
if ( function_exists( 'bcn_display' ) && ! is_front_page() ) {
echo '<div class="breadcrumbs">
You are here: <?php bcn_display(); ?>
</div>';
}
// End your PHP above
return ob_get_clean();
} );
Hi there,
Any reason why you need to turn it into a shortcode instead of just adding it as a function using a hook element?
Also are you sure the plugin doesn't provide a shortcode option to insert breadcrumb without you creating one? I know Yoast does for sure.
Hi,
I made a hook but how can I display it to be under the title "#inspiration" ? :(
Thanks in advance
Hi,
Here is the shortcode for those who are interted in :
function my_breadcrumb() {
if(function_exists('bcn_display') && !is_front_page()) {
$breadcrumb_output = '
';
return $breadcrumb_output;
}
}
add_shortcode( 'my_breadcrumb', 'my_breadcrumb' );
Hi there,
Looks like you set this to resolved - did you get it sorted?
Hello. I can ask you recording video, step by step how create breadcrumbs. (I’m use Yoast plugin).
I can’t understand what I must to do, for add breadcrumb in theme.
Thanks.
Any chance you can try the step by step guide here first?
https://docs.generatepress.com/article/adding-breadcrumbs/#using-hooks-element
If this doesn't work, please start a new topic and let us know which part you are struggling with.
Thanks!