Breadcrumbs different on single product page and category pages

Pending
REHub - Price Comparison, Affiliate Marketing, Multi Vendor Store, Community Theme REHub - Price Comparison, Affiliate Marketing, Multi Vendor Store, Community Theme September 28, 2022
Login to reply
Elise Bakken
11 months ago

Breadcrumbs are a useful navigational tool for e-commerce websites, and they allow users to easily understand their current location within the site's hierarchy. Here's an example of how you can implement breadcrumbs in WooCommerce:

First, you'll need to locate your theme's header.php file, which is usually located in the /wp-content/themes/[your-theme-name]/ directory.

Find the location where you want to display the breadcrumbs in your header.php file, and add the following code:

<?php if ( function_exists('yoast_breadcrumb') ) {

yoast_breadcrumb( '<p id="breadcrumbs">','</p>' );

} ?>

This code checks if the Yoast SEO plugin is installed and activated on your website, and if so, it uses the yoast_breadcrumb() function to generate the breadcrumb trail. If you're not using the Yoast SEO plugin, you can use a different breadcrumb plugin or write your own custom code to generate the breadcrumbs.

If you want to customize the appearance or behavior of the breadcrumbs, you can modify the parameters of the yoast_breadcrumb() function. Here are some examples:

// Change the separator between breadcrumb items to a forward slash

yoast_breadcrumb( '<p id="breadcrumbs">','</p>', ' > ' );

// Hide the breadcrumb trail on the homepage

if ( ! is_front_page() ) {

    yoast_breadcrumb( '<p id="breadcrumbs">','</p>' );

}

// Add a class to the breadcrumb container element

yoast_breadcrumb( '<p id="breadcrumbs" class="breadcrumbs">','</p>' );

These are just a few examples of the many ways you can customize the breadcrumbs on your WooCommerce site. By adding breadcrumbs, you can improve the user experience and make it easier for customers to navigate your online store.
I am a professional Woo Commerce developer. Recently i did add breadcrumb to Woo Commerce store. I attached the Image for an example. You can also check out the Breadcrumbs throw the link. Have a look https://soldfy.no/tilbehor/mobiltilbehor/mobil-lader-og-kabel

Igor Sunz Support Agent
1 year ago

if you want to overwrite values, you need to use !important https://www.w3schools.com/css/css_important.asp

Yvette Boye
1 year ago

As you can see the color code works on single product page for breadcrumbs, but not for shop archive pages. What is wrong with my code?

FYI: Code added ti Theme Options, General Options, Custom CSS

Yvette Boye
1 year ago

Managed to get red text on the second link below using this code:

.woocommerce-breadcrumb span.delimiter+a {padding: 4px 8px;color: #ff4136 !important;display: inline-block;margin-bottom: 5px;line-height: 13px;background-color: unset;}

The first link is still showing black text on breadcrumb. How do I fix?

Yvette Boye
1 year ago

Hi,

Changed code a bit. Added !important to existing code and managed to change code. First part of breadcrumb Black Friday (earlier Home breadcrumb) now works.

What code can I use to also get subcategories in red letters with black hover effect?

Updated code:

nav.woocommerce-breadcrumb{font-size:0 !important} nav.woocommerce-breadcrumb a, nav.woocommerce-breadcrumb span{font-size:13px !important}

nav.woocommerce-breadcrumb a, nav.woocommerce-breadcrumb span{font-weight: bold !important}

nav.woocommerce-breadcrumb a, nav.woocommerce-breadcrumb span{color: #ff4136 !important}

nav.woocommerce-breadcrumb a:hover {color: #111111 !important;transition-delay: 0.25s;}

Yvette Boye
1 year ago

Hi,

How can I get breadcrumbs in red letters with black hover effect in both product page and general product category pages (Woo Commerce)?

Has added the following code in Custom CSS in General Options in Theme Options, but it is not working on all breadcrumbs:

nav.woocommerce-breadcrumb{font-size:0 !important} nav.woocommerce-breadcrumb a, nav.woocommerce-breadcrumb span{font-size:13px !important}

nav.woocommerce-breadcrumb a, nav.woocommerce-breadcrumb span{font-weight: bold;}

nav.woocommerce-breadcrumb a, nav.woocommerce-breadcrumb span{color: #ff4136;}

nav.woocommerce-breadcrumb a:hover {color: #111111 !important;transition-delay: 0.25s;}

Pages tested on:

https://www.blackfridayoversikten.no/mobiler-og-tilbehor/mobillader/

https://www.blackfridayoversikten.no/solar-charger-21w-5705730420559/

Additional Info

Link on page with issue: https://www.blackfridayoversikten.no/solar-charger-21w-5705730420559/