If anyone is interested, I placed my Yoast breadcrumb directly under the title_hero (in /wp-content/themes/mesmerize/inc/header-options/content-options/inner-pages.php )
Note : As mentioned by cristianbarbu, it is better to use a plugin or create a child theme to override Mesmerize.
I wanted to remove the title of the article from the breadcrumb trail. The trick is to remove the last element of the breadcrumb trail.
Warning: this works for articles, but it also deletes the element when we are in a category (which breaks the consistency of the breadcrumb trail).
I finally found a trick that consists in adding an additional condition to the filter of the breadcrumb trail by using the function :
is_singular('post')
Here is the final code :
/*
template functions
*/
function mesmerize_print_inner_pages_header_content()
{
do_action('mesmerize_before_inner_page_header_content');
?>
<div class="inner-header-description gridContainer">
<div class="row header-description-row">
<div class="col-xs col-xs-12">
<h1 class="hero-title">
<?php echo mesmerize_title(); ?>
</h1>
<?php if ( function_exists('yoast_breadcrumb') ) {
function adjust_single_breadcrumb( $link_output) {
if (is_singular('post') AND (strpos( $link_output, 'breadcrumb_last' ) !== false )) {
$link_output = '';
}
return $link_output;
}
add_filter('wpseo_breadcrumb_single_link', 'adjust_single_breadcrumb' );
yoast_breadcrumb( '<p id="breadcrumbs">','</p>' );
}
?>
<?php
$show_subtitle = get_theme_mod('inner_header_show_subtitle', true);
$show_subtitle = apply_filters("inner_header_show_subtitle", $show_subtitle);
if ($show_subtitle && mesmerize_post_type_is(array('post', 'attachment'))):
?>
<p class="header-subtitle"><?php echo esc_html(get_bloginfo('description')); ?></p>
<?php endif; ?>
</div>
</div>
</div>
<?php
do_action('mesmerize_after_inner_page_header_content');
}
-
This reply was modified 2 years, 9 months ago by idbwebmaster.