Home Forums WoodMart support forum Change Default Breadcrumbs with Rank Math

Change Default Breadcrumbs with Rank Math

Viewing 19 posts - 1 through 19 (of 19 total)
  • Author
    Posts
  • #439961

    Cioppi88
    Participant

    Hi guys,
    I’m trying to follow the guide you posted here -> https://xtemos.com/forums/topic/integrate-rank-math-seo-breadcrumbs/ in order to change the default woocommerce breadcrumbs with Rank Math breadcrumbs.

    Can you please explain better how can I do?
    The step you show on this thread doesn’t works for me.

    #440352

    Hello,

    Please copy this file woocommerce/global/breadcrumb.php from the parent theme to the child theme keeping the same route. https://monosnap.com/file/qodfeNwVQpaXb9EEfQiRjQM6M3gAnF

    Add the code:

    if ( function_exists('rank_math_the_breadcrumbs') ) {
    	rank_math_the_breadcrumbs();
    	return;
    }

    Everything would work: https://monosnap.com/file/PEgzv0xdK3v677VyXegZI9EQv9B17Q

    If you have any questions please feel free to contact us.

    Best Regards

    #461042

    studio84digital
    Participant

    Dear this works well for the shop archive and product pages. Can this be used for the page and post breadcrumbs for the theme as well?

    #461046

    studio84digital
    Participant

    Some examples where breadcrumbs are shown: portfolio header, customer dashboard, posts archive and single posts

    #461377

    Hello,

    Please add this code to the functions.php of the child theme:

    if ( ! function_exists( 'woodmart_current_breadcrumbs' ) ) {
    	function woodmart_current_breadcrumbs( $type, $return = false ) {
    		if ( $return ) {
    			ob_start();
    		}
    
    		if ( function_exists('rank_math_the_breadcrumbs') ) {
    			rank_math_the_breadcrumbs();
    
    			if ( $return ) {
    				return ob_get_clean();
    			}
    
    			return;
    		}
    
    		if ( woodmart_get_opt( 'yoast_' . $type . '_breadcrumbs' ) && function_exists( 'yoast_breadcrumb' ) ) {
    			?>
    			<div class="yoast-breadcrumb">
    				<?php echo yoast_breadcrumb(); // phpcs:ignore ?>
    			</div>
    			<?php
    		} elseif ( 'shop' === $type ) {
    			woocommerce_breadcrumb();
    		} else {
    			woodmart_breadcrumbs();
    		}
    
    		if ( $return ) {
    			return ob_get_clean();
    		}
    	}
    } 

    If you have any questions please feel free to contact us.

    Best Regards

    #461422

    studio84digital
    Participant

    Hey Elise,

    Thank you. 2 more questions:
    – I notice mentions of yoast seo, Do I have to enable the yoast seo settings in the theme settings for it to work?
    – Does this replace the previous code for the products as well or do I have to use both?

    Thx in advance.
    Regards, Bart

    #461741

    Hello,

    You do not need to enable Yoas if you do not use it.

    This code rewrites the original functionality.

    If you have any questions please feel free to contact us.

    Best Regards

    #465884

    studio84digital
    Participant

    Hey Elise,

    I notice the breadcrumbs need some top padding/margin on shop and product pages. They are not alligned with other filters, see here:
    https://media.studio84.be/JruprkGz

    Any tips? Thanks in advance.

    #466066

    Hello,

    Your site access is not valid, please provide the shop page URL we will give CSS to add top margin.

    Best Regards

    #466409

    studio84digital
    Participant

    See extra information

    #466730

    Hello,

    Please add this code to the Theme Settings > Custom CSS > Global:

    nav.rank-math-breadcrumb{
    margin-top:30px;
    }

    Best Regards

    #466965

    studio84digital
    Participant

    Perfect, thank you Elise

    #467139

    You are welcome!

    Wish you a wonderful day!

    #490587

    Puddle123
    Participant

    Replying to comment #466730

    nav.rank-math-breadcrumb{
    margin-top:30px;
    }

    Is it possible to modify this code so that it only applies on the shop pages, not the product pages etc? It is needed on the shop page to have the breadcrumbs displayed on a level with the filters, but on the product pages the extra margin is wasting a lot of space. Please see screenshots.

    • This reply was modified 1 year, 8 months ago by Puddle123.
    Attachments:
    You must be logged in to view attached files.
    #490616

    Hello,

    Please try this code:

    body.woocommerce-shop nav.rank-math-breadcrumb{
    margin-top:30px;
    }

    Best Regards

    #490672

    Puddle123
    Participant

    Thanks for your reply. Unfortunately that code didn’t work, the breadcrumbs don’t have the margin applied on the shop pages – screenshot attached.

    Attachments:
    You must be logged in to view attached files.
    #490892

    Hello,

    Please provide the page URL with the breadcrumbs.

    Best Regards

    #491474

    Puddle123
    Participant

    I can’t share our website URL as the website is in maintenance mode. However, I can share the same page from your WoodMart Demo: https://woodmart.xtemos.com/shop. It’s the breadcrumbs which are shown on the ‘shop’ pages.

    #491560

    Hello,

    This block is wrapped and if we add a margin all the content will move: https://gyazo.com/be1d9f3b3c0b373e7835b2e7da9e437e if I add the margin, I get this https://gyazo.com/6bca98934d0656dd7c71a6e88ffbe749

    Please consider using the Woocommerce builder of WoodMart allowing to create custom templates for product pages and other functional pages that are not editable by default. Woocommerce builder is the inbuilt functionality widget included in the builder you use on the site.

    Please check this manual: https://xtemos.com/docs-cat/woocommerce-layouts-builder/?theme=woodmart

    If you have any questions please feel free to contact us.

    Best Regards

Viewing 19 posts - 1 through 19 (of 19 total)