• Resolved mytom

    (@mytom)


    Hello, i’ve installed WooCommerce Breadcrumbs and added code ‘woocommerce_breadcrumb();’ in my header PHP page. It works fine.

    But when i add a custom function to change Home url in my functions.php, nothing happens. The code added is here https://docs.woocommerce.com/document/customise-the-woocommerce-breadcrumb/ :

    add_filter( 'woocommerce_breadcrumb_home_url', 'woo_custom_breadrumb_home_url' );
    function woo_custom_breadrumb_home_url() {
        return 'https://woothemes.com';
    }

    My wordpress theme (kalium) has no breadcrumb by default.

    Thanks for help.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Anthony Hortin

    (@ahortin)

    Your theme is most likely creating its own Breadcrumbs. Usually, the default WooCommerce breadcrumbs will have a link on that very first ‘crumb’ (i.e. the Shop crumb), but looking at your site, there’s no link so I am guessing that your theme creates its own breadcrumbs rather than using the default WooCommerce breadcrumbs.

    Unfortunately, if your theme is creating it’s own breadcrumbs, then this plugin isn’t going to be of much help sorry. This plugin will only work with the default WooCommerce breadcrumbs.

    It might also be worth looking through the theme options for your theme to see if it has any options for the breadcrumbs. They might have some options built into the theme.

    Thread Starter mytom

    (@mytom)

    Thank you. But the theme i use (Kalium) does not support breadcrumbs (https://themeforest.net/item/kalium-creative-theme-for-professionals/10860525/comments?page=41).
    If i puts a specifiq url for ‘Home URL’ in the plugin interface, it works correctly.
    I want that this url redirect to shop page. But this one is different according to the language used (french: https://dadaparis.com/boutique/ ; english: https://dadaparis.com/en/shop/ ).
    I can not put 2 distinct adresses depending on the language in the interface.
    That’s why I would like to be able to change the address in the functions.php according to the lang.

    Plugin Author Anthony Hortin

    (@ahortin)

    Ahhh ok. I understand now.

    Try adding this to your theme. This is the WooCommerce filter that the plugin uses to update the Shop home URL…

    
    /**
     * Change the Home link for the Breadrumbs
     */
    function mytheme_woocommerce_breadcrumb_home_url() {
    	$ReturnVal = '';
    
    	// Set the value of $ReturnVal to the appropriate URL based on whether you're displaying the French or English page
    
    	return $ReturnVal;
    }
    add_filter( 'woocommerce_breadcrumb_home_url', 'mytheme_woocommerce_breadcrumb_home_url', 11 );
    

    You’ll need to update that code above so that it checks whether you’re currently displaying the French or English page, and then return the homepage value accordingly. I’m not familiar with your theme so I don’t know how it’s handling the multiple languages. That’s something you’ll need to look into yourself.

    Thread Starter mytom

    (@mytom)

    Thank you it works fine!!!
    Effectively it was the priority to specify (in add_filter).

    Plugin Author Anthony Hortin

    (@ahortin)

    Great to hear! Glad it worked.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Home URL not changing’ is closed to new replies.