Wrong bread crumb is being displayed at shop

This topic has 7 replies, 4 voices, and was last updated 1 days, 1 hours ago ago by Andrew Mitchell

  • Avatar: Awais Bhatti
    Awais Bhatti
    Participant
    August 26, 2024 at 00:26

    Hello

    I have renamed “shop” page to “products” but when I open a category-page it does add “shop” in the breadcrumb in addition to “products”.

    current result: home > shop > products > category-name

    Note: both shop and products point to the same URL domain.com/products

    expected result: home > products > category-name

    > shop should be removed.

    By the way, I have tested the $crumbs from woocommerce it doesn’t have ‘shop’ in the array, so why does it show on the front end?

    please see the screenshots for your reference.

    I am wondering if there’s no page named shop on my website then why it shows up in the breadcrumbs on front end?

    Best Regards
    Awais

    Please, contact administrator
    for this information.
    6 Answers
    Avatar: Tony Rodriguez
    Tony Rodriguez
    Support staff
    August 26, 2024 at 05:17

    Hello, @Awais Bhatti,

    Thank you for contacting us and for using XStore.

    We are pleased to inform you that the issue you reported has been successfully resolved. To ensure that the changes are reflected on your end, please clear your browser’s cache and then revisit your site.

    To address the issue, we have implemented a new code snippet in your child-theme/functions.php file. For your reference, we have uploaded images detailing these changes in the private content area.

    add_filter( 'etheme_breadcrumbs_shop_step', '__return_false', 999);

    Please note that the Shop page is a default feature of the WooCommerce plugin and functions as an archive page.

    We hope this resolution meets your expectations. Should you have any further inquiries or require additional assistance, please do not hesitate to contact us.

    Best Regards,
    The 8Theme Team

    Please contact administrator
    for this information.
    Avatar: Awais Bhatti
    Awais Bhatti
    Participant
    August 26, 2024 at 23:32

    Hi Thanks. I appreciate it, this also happens with blogs https://jarahi.pk/articles/audio-electronics/cross-border-e-commerce/ i have renamed blog to articles, please help me with that as well

    Avatar: Tony Rodriguez
    Tony Rodriguez
    Support staff
    August 27, 2024 at 06:21

    Hello, @Awais Bhatti,

    Thank you for your response.

    If you are looking to change the breadcrumb title from “Blog” to “Articles” on your website, please follow the steps outlined below:

    1. Install the Loco Translate plugin on your website.
    2. Navigate to Loco > Themes > XStore within the plugin.
    3. Locate the word “Blog” in the XStore theme language file and replace it with “Articles.”
    4. Save your settings.

    For visual guidance, please refer to the images provided in the private content area of this message.

    We also recommend reviewing our theme documentation for further assistance: [XStore Theme Documentation](https://www.8theme.com/documentation/xstore/theme-translation/base-theme-translation/).

    Once you have made the necessary changes, you may deactivate the Loco Translate plugin at your convenience.

    We trust this information will be helpful to you. Should you have any further questions, please do not hesitate to contact us.

    Best Regards,
    The 8Theme Team

    Please contact administrator
    for this information.
    Avatar: Awais Bhatti
    Awais Bhatti
    Participant
    September 11, 2024 at 17:13

    Hi

    Thanks for your answer, but why it can’t be done with PHP code, just for one small thing I don’t want to install a whole new plugin.

    Further, https://jarahi.pk/articles/audio-electronics/ the breadcrumbs on this should be Home > Articles > Audio Electronics but it shows -> Home > Category: Audio Electronics, how can I fix that?

    Another thing that is out of order is that the brand base is not showing up in the breadcrumbs. https://jarahi.pk/brands/apple/

    Why there are so many issues with the breadcrumbs?

    Best Regards
    Awais

    Avatar: Justin
    Luca Rossi
    Support staff
    September 12, 2024 at 16:18

    Hi @Awais Bhatti,

    Please create a PHP file named as breadcrumb.php under this directory x-child/templates/ with the following codes:

    
    <?php  if ( ! defined('ABSPATH')) exit('No direct script access allowed');
    /**
     * The template for displaying theme breadcrumbs
     *
     * Override this template by copying it to yourtheme/templates/breadcrumbs.php
     * @author 	   8theme
     * @link       http://xstore.8theme.com
     * @license    Themeforest Split Licence
     * @since   6.4.5
     * @xstore-version 9.4.0
     */
    
    global $post;
    
    if( function_exists( 'is_bbpress' ) && is_bbpress() ) {
    	bbp_breadcrumb();
    	return;
    }
    
    $args = array(
    	'delimiter'   => '<span class="delimeter"><i class="et-icon et-'.(get_query_var('et_is-rtl', false) ? 'left' : 'right' ).'-arrow"></i></span>',
    	'home'        => esc_html__( 'Home', 'xstore' ),
    	'showCurrent' => 0,
    	'before'      => '<span class="current">',
    	'after'       => '</span>',
    	'title_tag' => get_theme_mod('breadcrumb_title_tag', 'h1'),
    	'category_title_tag' =>  get_theme_mod('breadcrumb_category_title_tag', 'h1'),
    );
    
    if ( !$args['title_tag'] ){
    	$args['title_tag'] = 'h1';
    }
    
    if ( !$args['category_title_tag'] ){
    	$args['category_title_tag'] = 'h1';
    }
    
    $post_page    = get_option( 'page_for_posts' );
    $title_at_end = ( ! empty( $post_page ) ) ? '<a href="' . get_permalink( $post_page ) . '">' . esc_html__( 'Articles', 'xstore' ) . '</a>' : '';
    $homeLink     = home_url();
    $xstore_title = '';
    $html         = '';
    
    if( is_home() ) {
    	if( empty( $post_page ) && ! get_query_var('et_is-single', false) && ! is_page() ) $xstore_title = esc_html__( 'Articles', 'xstore' );
    	$xstore_title = get_the_title( $post_page );
    }
    
    if ( is_front_page() ) {
    	$xstore_title = "";
    //	    do_action( 'etheme_before_breadcrumbs' );
    //	    echo '<h1 class="title"><span>'.$args['home'].'</span></h1>';
    //	    do_action( 'etheme_after_breadcrumbs' );
    } else if ( class_exists( 'bbPress' ) && is_bbpress() ) {
    	$xstore_title    = esc_html__( 'Forums', 'xstore' );
    	$bbp_args = array(
    		'before' => '<div class="breadcrumbs" id="breadcrumb">',
    		'after'  => '</div>'
    	);
    	bbp_breadcrumb($bbp_args);
    } else {
    	$html .= '<div class="breadcrumbs">';
    	$html .= '<div id="breadcrumb">';
    	$html .= '<a href="' . $homeLink . '">' . $args['home'] . '</a> ' . $args['delimiter'] . ' ';
    
    	if ( is_category() ) {
    		$args['title_tag'] = $args['category_title_tag'];
    		$xstore_title = esc_html__( 'Category: ', 'xstore' ) . single_cat_title( '', false );
    		$title_at_end = '';
    		$thisCat      = get_category( get_query_var( 'cat' ), false );
    		$cat_id       = get_cat_ID( single_cat_title( '', false ) );
    
    		if ( $thisCat->parent != 0 ){
    			$html .= get_category_parents( $thisCat->parent, true, ' ' . $args['delimiter'] . ' ' );
    		}
    
    		$html .= '<a href="https://jarahi.pk/articles/">Articles</a><span class="delimeter"><i class="et-icon et-right-arrow"></i></span>'. sprintf(
    				'<a class="current" href="%s">%s%s "%s"%s</a>',
    				get_category_link( $cat_id ),
    				$args['before'],
    				esc_html__( 'Archive by category', 'xstore' ),
    				single_cat_title( '', false ),
    				$args['after']
    			);
    	} elseif ( is_search() ) {
    		$xstore_title = esc_html__( 'Search Results for: ', 'xstore' ) . get_search_query();
    	} elseif ( is_day() ) {
    		$xstore_title = esc_html__( 'Daily Archives: ', 'xstore' ) . get_the_date();
    		$title_at_end = '';
    
    		$html .= sprintf(
    			'<a href="%s">%s</a> %s',
    			get_year_link( get_the_time( 'Y' ) ),
    			get_the_time( 'Y' ),
    			$args['delimiter']
    		);
    		$html .= sprintf(
    			'<a href="%s">%s</a> %s',
    			get_month_link( get_the_time( 'Y' ), get_the_time( 'm' ) ),
    			get_the_time( 'F' ),
    			$args['delimiter']
    		);
    		$html .= sprintf(
    			'<a class="current" href="%s">%s%s%s</a>',
    			get_day_link( get_the_time( 'Y' ), get_the_time( 'm' ), get_the_time( 'j' ) ),
    			$args['before'],
    			get_the_time( 'd' ),
    			$args['after']
    		);
    	} elseif ( is_month() ) {
    		$xstore_title = esc_html__( 'Monthly Archives: ', 'xstore') . get_the_date( _x( 'F Y', 'monthly archives date format', 'xstore' ) );
    		$title_at_end = '';
    
    		$html .= sprintf(
    			'<a href="%s">%s</a> %s',
    			get_year_link( get_the_time( 'Y' ) ),
    			get_the_time( 'Y' ),
    			$args['delimiter']
    		);
    		$html .= sprintf(
    			'<a class="current" href="%s">%s%s%s</a>',
    			get_month_link( get_the_time( 'Y' ), get_the_time( 'm' ) ),
    			$args['before'],
    			get_the_time( 'F' ),
    			$args['after']
    		);
    	} elseif ( is_year() ) {
    		$xstore_title = esc_html__( 'Yearly Archives: ', 'xstore' ) . get_the_date( _x( 'Y', 'yearly archives date format', 'xstore' ) );
    		$title_at_end = '';
    
    		$html .= sprintf(
    			'<a class="current" href="%s">%s%s%s</a>',
    			get_year_link( get_the_time( 'Y' ) ),
    			$args['before'],
    			get_the_time( 'Y' ),
    			$args['after']
    		);
    	} elseif ( get_query_var('et_is-single', false) && ! is_attachment() ) {
    		$xstore_title = get_the_title();
    		if ( get_post_type() == 'etheme_portfolio' ) {
    			$portfolioId   = get_theme_mod( 'portfolio_page', '' );
    			$portfolioLink = get_permalink( $portfolioId );
    			$post_type     = get_post_type_object( get_post_type() );
    			$page          = get_page( $portfolioId );
    			$slug          = $post_type->rewrite;
    			$title_at_end  = $page->post_title;
    
    			$html .= '<a href="' . $portfolioLink . '">' . $title_at_end . '</a>';
    			$title_at_end = '<a href="' . $portfolioLink . '">' . $title_at_end . '</a>';
    
    			$cat = wp_get_post_terms(get_the_ID(), 'portfolio_category');
    
    			if( isset( $cat[0] ) ) {
    				$cat  = $cat[0];
    
    				$html .= ' ' . $args['delimiter'] . ' ' . '<a href="' . get_term_link($cat, 'portfolio_category') . '">' . esc_html($cat->name) . '</a>';
    			}
    
    			if ( $args['showCurrent'] == 1 ){
    				$html .= ' ' . $args['delimiter'] . ' ' . $args['before'] . get_the_title() . $args['after'];
    			}
    		} elseif ( get_post_type() != 'post' ) {
    			$post_type    = get_post_type_object( get_post_type() );
    			$slug         = $post_type->rewrite;
    			$title_at_end = $post_type->labels->singular_name;
    //                $title_at_end = '<a href="' . $homeLink . '/' . $slug['slug'] . '/">' . $title_at_end . '</a>';
    			$href = $homeLink;
    			// fix for elementor_library post type
    			if ( is_array($slug) ) {
    				$href = $homeLink . '/' . $slug['slug'];
    			}
    			$title_at_end = '<a href="' . $href . '/">' . $title_at_end . '</a>';
    
    			$html .= '<a href="' . $href . '/">' . $title_at_end . '</a>';
    			if ( $args['showCurrent'] == 1 ){
    				$html .= ' ' . $args['delimiter'] . ' ' . $args['before'] . get_the_title() . $args['after'];
    			}
    		} else {
    			$cat = get_the_category();
    			if( isset( $cat[0] ) ) {
    				$cat  = $cat[0];
    				$cats = get_category_parents($cat, TRUE, ' ' . $args['delimiter'] . ' ');
    
    				if ( $args['showCurrent'] == 0 ) {
    					$cats = preg_replace("#^(.+)\s" . $args['delimiter'] . "\s$#", "$1", $cats);
    				}
    
    				if ($title_at_end){
    					$html .= ' ' . $title_at_end . ' ' . $args['delimiter'] . ' ';
    				}
    
    				$html .= $cats;
    			}
    			if ( $args['showCurrent'] == 1 ) {
    				$html .= $args['before'] . get_the_title() . $args['after'];
    			}
    		}
    	} elseif ( is_tax('portfolio_category') ) {
    		$xstore_title  = single_term_title( '', false );
    		$portfolioId   = get_theme_mod( 'portfolio_page', '' );
    		$post          = get_page( $portfolioId );
    		$portfolioLink = get_permalink($portfolioId);
    		$title_at_end  = $post->post_title;
    
    		$html .= '<a href="' . $portfolioLink . '">' . $title_at_end . '</a>' . $args['delimiter'];
    		$title_at_end = '<a href="' . $portfolioLink . '">' . $title_at_end . '</a>' . $args['delimiter'];
    	} elseif ( ! is_single() && ! is_page() && get_post_type() != 'post' && ! is_404() ) {
    		$post_type    = get_post_type_object( get_post_type() );
    //            $title_at_end = $post_type->labels->singular_name;
    		// code below was left after one client asked about php notices in debug log with unfound link/page but only error
    		if ( is_object($post_type) && property_exists($post_type, 'labels') ) {
    			if ( property_exists($post_type->labels, 'singular_name') ) {
    				$title_at_end = $post_type->labels->singular_name;
    				$html .= $args['before'] . $title_at_end . $args['after'];
    			}
    		}
    
    	} elseif ( is_attachment() ) {
    		$parent        = get_post( $post->post_parent );
    		$xstore_title  = get_the_title();
    
    		if ( $args['showCurrent'] == 1 ) {
    			$title_at_end = get_the_title();
    			$html .= ' '  . $args['before'] . $title_at_end . $args['after'];
    		}
    	} elseif ( is_page() && ! $post->post_parent ) {
    		$xstore_title = get_the_title();
    
    		if ( $args['showCurrent'] == 1 ) {
    			$title_at_end = get_the_title();
    			$html .= $args['before'] . $title_at_end . $args['after'];
    		}
    	} elseif ( is_page() && $post->post_parent ) {
    		$xstore_title= get_the_title();
    		$parent_id   = $post->post_parent;
    		$breadcrumbs = array();
    
    		while ( $parent_id ) {
    			$page          = get_page( $parent_id );
    			$breadcrumbs[] = '<a href="' . get_permalink( $page->ID ) . '">' . get_the_title( $page->ID ) . '</a>' . $args['delimiter'];
    			$parent_id     = $page->post_parent;
    		}
    		$breadcrumbs = array_reverse( $breadcrumbs) ;
    
    		for ( $i = 0; $i < count( $breadcrumbs ); $i++ ) {
    			$html .= $breadcrumbs[$i];
    			if ( $i != count( $breadcrumbs ) -1 ) $html .= ' ' . $args['delimiter'] . ' ';
    		}
    		if  ($args['showCurrent'] == 1 ) $html .= ' ' . $args['delimiter'] . ' ' . $args['before'] . get_the_title() . $args['after'];
    	} elseif ( is_tag() ) {
    		$xstore_title = esc_html__( 'Tag: ', 'xstore' ) . single_tag_title( '', false );
    		$title_at_end = single_tag_title( '', false );
    
    		$html .= $args['before'] . esc_html__('Posts tagged', 'xstore') . ' "' . $title_at_end . '"' . $args['after'];
    	} elseif ( is_author() ) {
    		global $author;
    
    		$xstore_title = esc_html__( 'All posts by ', 'xstore' ) . get_the_author();
    		$userdata     = get_userdata($author);
    		$title_at_end = $userdata->display_name;
    
    		$html .= $args['before'] . esc_html__('Articles posted by ', 'xstore') . $args['after'] . get_the_author_posts_link();
    	} elseif ( is_404() ) {
    		$xstore_title = esc_html__( 'Page not found', 'xstore' );
    		$html .= $args['before'] . esc_html__('Error 404', 'xstore') . $args['after'];
    	} elseif ( is_tax( 'post_format', 'post-format-aside' ) ) {
    		$xstore_title = esc_html__( 'Asides', 'xstore' );
    	} elseif ( is_tax( 'post_format', 'post-format-video' ) ) {
    		$xstore_title = esc_html__( 'Videos', 'xstore' );
    	} elseif ( is_tax( 'post_format', 'post-format-audio' ) ) {
    		$xstore_title = esc_html__( 'Audio', 'xstore' );
    	} elseif ( is_tax( 'post_format', 'post-format-quote' ) ) {
    		$xstore_title = esc_html__( 'Quotes', 'xstore' );
    	} elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) {
    		$xstore_title = esc_html__( 'Galleries', 'xstore' );
    	} elseif( is_archive() ) {
    		$xstore_title = esc_html__( 'Archives', 'xstore' );
    	}
    
    	if ( get_query_var( 'paged' ) ) {
    		$xstore_title = esc_html__( 'Page', 'xstore' ) . ' ' . get_query_var( 'paged' );
    		$html .= ( ! empty( $title_at_end ) ) ? $title_at_end . ' ' . $args['delimiter'] : '';
    	}
    
    	$html .= '</div>';
    	if( get_theme_mod('return_to_previous', 1) ) $html .= etheme_back_to_page();
    	$html .= '</div>';
    
    	$xstore_title = apply_filters('etheme_breadcrumbs_page_title', $xstore_title );
    	$html .= ' <' . $args['title_tag'] . ' class="title"><span>' . $xstore_title . '</span></'.$args['title_tag'].'>';
    
    	do_action( 'etheme_before_breadcrumbs' );
    	echo $html; // All data escaped
    	do_action( 'etheme_after_breadcrumbs' );
    
    }
    

    Another thing that is out of order is that the brand base is not showing up in the breadcrumbs. https://jarahi.pk/brands/apple/

    Can you please explain what you mean, we’re still not clear on this point?

    Best Regards,
    The 8Theme Team

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    November 9, 2024 at 16:00

    Dear Awais Bhatti,

    Choosing our theme reflects your commitment to quality, and for that, we’re genuinely grateful. As we constantly strive to elevate your experience, your feedback is an invaluable gift. Could you kindly take a moment to rate our product with 5 stars on ThemeForest?

    Click here to share your insights: https://themeforest.net/downloads

    Your support fuels our journey, and we appreciate it more than words can express.

    Best Regards,
    The 8Theme Team

  • Viewing 7 results - 1 through 7 (of 7 total)

The issue related to '‘wrong bread crumb is being displayed at shop’' has been successfully resolved, and the topic is now closed for further responses

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.