Breadcrumbs not agreeing

Hey There,
I hope your week is off to a great start!

There is a breadcrumb issue on one of my sites currently in development. On the events page, is says archives instead of Events.

How can this be fixed so the Breadcrumb says Events instead of Archives?

Thanks so much for your help.

Best,
Nancy

Hey Nancy,

X (also Pro) adds its own term meta for the default Post type and the X Portfolio post type. The X term meta is the Archive Title you see when you edit a Post or Portfolio category.

Changing that would change the breadcrumb text for the term like the categories and tags. It does not support custom post types like your Events however. For that, you need to integrate the Archive Title term meta to your Events post type. That would require custom development so you need to consult with a third party developer for this. You can see how the term meta is added in this file wp-content\themes\x\framework\functions\global\admin\meta\taxonomies.php. That will give some guidance for the developer to integrate the term meta to your custom post type.

Thanks.

Thanks Christian! That’s a big help.

I’ll reach out to the people at the plugin.

Best Regards,
Nancy

Thank you.

Hi Joao,
I have heard from the plugin developer, and he has provided a solution in the form of additional php.

He has requested that I drop the php in the theme’s functions.php file. But I am wondering if I should place it in the Child theme. Won’t it be overwritten when the theme is updated?

Could you please advise: Below is the php:

function x_breadcrumbs() {

if ( x_get_option( ‘x_breadcrumb_display’ ) ) {

GLOBAL $post;

$is_ltr = ! is_rtl();
$stack = x_get_stack();
$delimiter = x_get_breadcrumb_delimiter(); $home_text = x_get_breadcrumb_home_text(); $home_link = home_url(); $current_before = x_get_breadcrumb_current_before();
$current_after = x_get_breadcrumb_current_after(); $page_title = get_the_title(); $blog_title = get_the_title( get_option( ‘page_for_posts’, true ) );

if ( ! is_404() ) {
$post_parent = $post->post_parent;
} else {
$post_parent = ‘’;
}

if ( X_WOOCOMMERCE_IS_ACTIVE ) {
$shop_url = x_get_shop_link();
$shop_title = x_get_option( ‘x_’ . $stack . ‘_shop_title’ ); $shop_link = ‘’ . $shop_title . ‘’; }

echo ‘<div class=“x-breadcrumbs”>’ . $home_text . ‘’ . $delimiter;

if ( is_home() ) {

echo $current_before . $blog_title . $current_after;

} elseif ( is_category() ) {

$the_cat = get_category( get_query_var( ‘cat’ ), false ); if ( $the_cat->parent != 0 ) echo get_category_parents( $the_cat->parent, TRUE, $delimiter ); echo $current_before . single_cat_title( ‘’, false ) . $current_after;

} elseif ( x_is_product_category() ) {

if ( $is_ltr ) {
echo $shop_link . $delimiter . $current_before . single_cat_title( ‘’, false ) . $current_after; } else { echo $current_before . single_cat_title( ‘’, false ) . $current_after . $delimiter . $shop_link; }

} elseif ( x_is_product_tag() ) {

if ( $is_ltr ) {
echo $shop_link . $delimiter . $current_before . single_tag_title( ‘’, false ) . $current_after; } else { echo $current_before . single_tag_title( ‘’, false ) . $current_after . $delimiter . $shop_link; }

} elseif ( is_search() ) {

echo $current_before . __( 'Search Results for ', ‘x’ ) . ‘“’ . get_search_query() . ‘”’ . $current_after;

} elseif ( is_singular( ‘post’ ) ) {

if ( get_option( ‘page_for_posts’ ) == is_front_page() ) { echo $current_before . $page_title . $current_after; } else { if ( $is_ltr ) { echo ‘’ . $blog_title . ‘’ . $delimiter . $current_before . $page_title . $current_after; } else { echo $current_before . $page_title . $current_after . $delimiter . ‘’ . $blog_title . ‘’; } }

} elseif ( x_is_portfolio() ) {

echo $current_before . get_the_title() . $current_after;

} elseif ( x_is_portfolio_item() ) {

$link = x_get_parent_portfolio_link();
$title = x_get_parent_portfolio_title();

if ( $is_ltr ) {
echo ‘’ . $title . ‘’ . $delimiter . $current_before . $page_title . $current_after; } else { echo $current_before . $page_title . $current_after . $delimiter . ‘’ . $title . ‘’; }

} elseif ( x_is_product() ) {

if ( $is_ltr ) {
echo $shop_link . $delimiter . $current_before . $page_title . $current_after; } else { echo $current_before . $page_title . $current_after . $delimiter . $shop_link; }

} elseif ( x_is_buddypress() ) {

if ( bp_is_group() ) {
echo ‘’ . x_get_option( ‘x_buddypress_groups_title’ ) . ‘’ . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after; } elseif ( bp_is_user() ) { echo ‘’ . x_get_option( ‘x_buddypress_members_title’ ) . ‘’ . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after; } else { echo $current_before . x_buddypress_get_the_title() . $current_after; }

} elseif ( x_is_bbpress() ) {

remove_filter( ‘bbp_no_breadcrumb’, ‘__return_true’ );

if ( bbp_is_forum_archive() ) {
echo $current_before . bbp_get_forum_archive_title() . $current_after; } else { echo bbp_get_breadcrumb(); }

add_filter( ‘bbp_no_breadcrumb’, ‘__return_true’ );

} elseif ( is_page() && ! $post_parent ) {

echo $current_before . $page_title . $current_after;

} elseif ( is_page() && $post_parent ) {

$parent_id = $post_parent;
$breadcrumbs = array();

if ( is_rtl() ) {
echo $current_before . $page_title . $current_after . $delimiter; }

while ( $parent_id ) {
$page = get_page( $parent_id );
$breadcrumbs[] = 'ID ) . ‘">’ . get_the_title( $page->ID ) . ‘’; $parent_id = $page->post_parent; }

if ( $is_ltr ) {
$breadcrumbs = array_reverse( $breadcrumbs ); }

for ( $i = 0; $i < count( $breadcrumbs ); $i++ ) { echo $breadcrumbs[$i]; if ( $i != count( $breadcrumbs ) -1 ) echo $delimiter; }

if ( $is_ltr ) {
echo $delimiter . $current_before . $page_title . $current_after; }

} elseif ( is_tag() ) {

echo $current_before . single_tag_title( ‘’, false ) . $current_after;

} elseif ( is_author() ) {

GLOBAL $author;
$userdata = get_userdata( $author );
echo $current_before . __( 'Posts by ', ‘x’ ) . ‘“’ . $userdata->display_name . $current_after . ‘”’;

} elseif ( is_404() ) {

echo $current_before . __( ‘404 (Page Not Found)’, ‘x’ ) . $current_after;

} elseif ( is_archive() ) {

if ( x_is_shop() ) {
echo $current_before . $shop_title . $current_after; } elseif ( class_exists( ‘Tribe__Events__Main’ ) && tribe_is_event_query() ) { echo $current_before . ‘Events’ . $current_after; } else { echo $current_before . __( 'Archives ', ‘x’ ) . $current_after; }

}

echo ‘</div>’;

}

}

Hi again,

Yes you should add the above code in your Child Theme’s functions.php file so it won’t get overwritten when the theme is updated.

Cheers!

Thank you!

You’re welcome!