• Hi,

    I love Storefront and use it for Woocommerce shops AND simple websites.

    I have been testing and trying to get breadcrumbs and noticed they only appear in the Storefront theme as soon as and ONLY if I install the Woocommerce plugin!

    I tried activating the Yoast breadcrumbs and adding this code to ( tried the header.php, page.php and single.php in my child theme ) but does not work or puts the site blanc:

    <?php if ( function_exists('yoast_breadcrumb') ) 
    {yoast_breadcrumb('<p id="breadcrumbs">','</p>');} ?>

    Is there a way to make breadcrumbs appear in Storefront without having to install Woocommerce please or add code?

    Thanks,
    Annie

    • This topic was modified 8 years, 5 months ago by LogoLogics.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey,

    Is there a way to make breadcrumbs appear in Storefront without having to install Woocommerce please or add code?

    I’m afraid not. As Storefront is designed specifically for use with WooCommerce we decided to adopt the WooCommerce breadcrumb feature rather than include a separate one.

    You’ll need to use a separate plugin for this. Personally I’d recommend this one, although I’ve never tried integrating it with Storefront.

    Thread Starter LogoLogics

    (@logologics)

    Hi James,

    I understand. Too bad, because I love using storefront for both…

    Before even bothering you with this ?? I tried several plugins ( most of them are not updated for over a year ) and the easiest ones that do work, only work on pages ( you need to insert a shortcode ) and they are placed below the page title instead of above and for some reason all of them repeat the breadcrumb three times like this:

    You are here:Home>SUB1>SUB1>SUB1

    The shortcode option can not be used on the blog archieve as there is no content to add a shortcode.

    Yoast breadcrumbs ( adding the code yoast tells us to add ) I can’t get it to work.
    Thing is it seems to depend on the theme as of where the code should be added to work.

    Most of the time it seems to be added to the header.php, page.php or single.php.
    Sadly I tried them all in Storefront and so far no luck.

    Maybe you can tell me where I should add the code ( wich php file of Storefront and where in that files code ) so I get the breadcrumbs of Yoast seo plugin working?

    Yoast SEO is active in all of my sites anyway and is well suported.
    If I could get that one working, it would be solved for Storefront without Woocommerce?

    https://kb.yoast.com/kb/implement-wordpress-seo-breadcrumbs/

    Thanks,
    Annie

    Thread Starter LogoLogics

    (@logologics)

    For those who might be still searching to get breadcrumbs working if no woocommerce is added to Storefront, I figured it out ( trial and error ) and here is how to do this:

    – Install Yoast SEO plugin and acitvate the breadcrumbs in its settings
    – Go to the Storefront parent theme folder ( wp-content/themes/storefront )
    – Download the header.php file to your desktop

    open this file with tool like html KIT, Notepad++ or similar
    In that file search for this code:

    </div>
    	</header><!-- #masthead -->
    
    	<?php

    and put the following Yoast breadcrumb code right under it:

    if ( function_exists('yoast_breadcrumb') ) {
    yoast_breadcrumb('
    <p id="breadcrumbs">','</p>
    ');
    }

    – save this file on your desktop
    – upload it to your child themes folder ( filezilla, cPanel or similar )
    – save that and close the program
    – reload the page in your website and the breadcrumbs are there!

    You can style things using these CSS codes ( change to your preferences )
    Put these in your child themes style.css

    .breadc{
            font-size:14px;
            width: 959px;
            margin: 0 auto;
            background: #FFFFFF;
            border: 1px solid #F9F9F9
    }
    #breadcrumbs{
           margin-left: 20px
           margin-top: 230px
           margin-bottom: 15px
    }

    The conplete altered code in your child theme’s header.php should look like this if all was done like the above:

    <?php
    /**
     * The header for our theme.
     *
     * Displays all of the <head> section and everything up till <div id="content">
     *
     * @package storefront
     */
    
    ?><!DOCTYPE html>
    <html <?php language_attributes(); ?>>
    <head>
    <meta charset="<?php bloginfo( 'charset' ); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
    <link rel="profile" href="https://gmpg.org/xfn/11">
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
    
    <?php wp_head(); ?>
    </head>
    
    <body <?php body_class(); ?>>
    <div id="page" class="hfeed site">
    	<?php
    	do_action( 'storefront_before_header' ); ?>
    
    	<header id="masthead" class="site-header" role="banner" style="<?php storefront_header_styles(); ?>">
    		<div class="col-full">
    
    			<?php
    			/**
    			 * Functions hooked into storefront_header action
    			 *
    			 * @hooked storefront_skip_links                       - 0
    			 * @hooked storefront_social_icons                     - 10
    			 * @hooked storefront_site_branding                    - 20
    			 * @hooked storefront_secondary_navigation             - 30
    			 * @hooked storefront_product_search                   - 40
    			 * @hooked storefront_primary_navigation_wrapper       - 42
    			 * @hooked storefront_primary_navigation               - 50
    			 * @hooked storefront_header_cart                      - 60
    			 * @hooked storefront_primary_navigation_wrapper_close - 68
    			 */
    			do_action( 'storefront_header' ); ?>
    
    		</div>
    	</header><!-- #masthead -->
    
    	<?php
    
    if ( function_exists('yoast_breadcrumb') ) {
    yoast_breadcrumb('
    <p id="breadcrumbs">','</p>
    ');
    }
    
    	/**
    	 * Functions hooked in to storefront_before_content
    	 *
    	 * @hooked storefront_header_widget_region - 10
    	 */
    	do_action( 'storefront_before_content' ); ?>
    
    	<div id="content" class="site-content" tabindex="-1">
    		<div class="col-full">
    
    		<?php
    		/**
    		 * Functions hooked in to storefront_content_top
    		 *
    		 * @hooked woocommerce_breadcrumb - 10
    		 */
    		do_action( 'storefront_content_top' );

    Good luck!
    Annie

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘No breadcrumbs if no Woocommerce?’ is closed to new replies.