How to Add a Sidebar to Storefront WooCommerce Theme

Storefront comes shipped with 1 sidebar. We want to add more sidebars so that we can provide relevant content based on the page content.

Here are the steps (refer back to video for clarification if needed):

1. Copy sidebar.php from your storefront theme and place it in your child theme. Change the name of the file to sidebar-yourNewSidebar.php and alter the code on that page for your new sidebar name. My example:

* The sidebar containing the second sidebar area.
* @package storefront

if ( ! is_active_sidebar( ‘sidebar2’ ) ) {

<div id=”secondary” class=”widget-area” role=”complementary”>
<?php dynamic_sidebar( ‘sidebar2’ ); ?>
</div><!– #secondary –>

2. In functions.php file of child theme, add the following code to register your sidebar (obviously change the names to what your sidebar is called):

add_action( ‘widgets_init’, ‘register_matts_sidebars’ );

function register_matts_sidebars() {

‘id’ => ‘sidebar2’,
‘name’ => __( ‘Sidebar 2’, ‘storefront’ ),
‘description’ => __( ‘Matts Custom Sidebar.’, ‘storefront’ ),
‘before_widget’ => ‘<div id=”%1$s” class=”widget %2$s”>’,
‘after_widget’ => ‘</div>’,
‘before_title’ => ‘<h4 class=”widgettitle”>’,
‘after_title’ => ‘</h4>’,

3. Find the template files that you want to override and copy them to your child theme. Comment out (or delete) the previously registered sidebar and add your new sidebar:

eg. I changed the archive.php file at the bottom:

//do_action( ‘storefront_sidebar’ );

That should be it.  Add sidebars and override your storefront theme template files to your heart’s content. 🙂  This is also a good example of why it’s good to hire a web developer that’s versed in SEO.

Fixing the Yoast SEO XML Sitemap for Open SEO Stats Chrome Extension

Yoast_SEO Plugin for WordPressYoast is a good SEO plugin for WordPress if you’re like me and don’t want to spend 2 hours on each post or page you want to publish.  However, I just noticed that my chrome extension was saying that my website didn’t have a sitemap! ha… I’m using WordPress with the Yoast plugin and it generates a sitemap as sitemap_index.xml

So anyway, to get the “green checkmark” from the chrome Open SEO stats Extension and avoid confusing the ‘internet’ just put this following code in your .htaccess: (Make sure mod-rewrite is on… but really, who’s isn’t for WordPress sites – oh, and of course replace your website name for exampledomainname, and remove the “s” on https if your site isn’t secure):

RewriteCond %{HTTP_HOST} ^exampledomainname\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.exampledomainname\.com$
RewriteRule ^sitemap\.xml$ "https\:\/\/www\.exampledomainname\.com\/sitemap\_index\.xml" [R=301,L]