Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Roots Theme and WooCommerce - duplicated header

I installed WordPress 3.4.2 with the latest version of Roots theme (6.1.0 - October 2012), and the latest version of WooCommerce.

I found that the header method of Roots had a conflict with WooCommerce, which was also spitting out a default WordPress header. I ended up with two headers - one being the one I wanted (from Roots - the fixed Bootstap top navbar) and another which I didn't - my site name and the old "Just another WordPress website" subtitle.

How does one fix this?

like image 263
codewithfeeling Avatar asked Oct 19 '12 16:10

codewithfeeling


2 Answers

This is because of the new version of Roots uses a "theme wrapper" which isn't compatible with the way Woo Commerce is looking for template overrides.

After a bit of head-bashing, I realised the simplest solution is just to do the following - in your theme folder, add a new header.php file, completely blank. That overrides the WooCommerce insert of your normal header.php file, then Roots can do its thing and pull out templates/head.php as your header.

You also need to add a blank footer.php

There is probably a more elegant solution removing hooks to the head and footer, but for now, that is a quick fix that is working for me. Once I've found the other method, I'll post it here.

like image 121
codewithfeeling Avatar answered Nov 15 '22 08:11

codewithfeeling


I just tried this on Roots v 6.3.0 and ran into some issues. I used https://github.com/DoersGuild/wp-roots-woocommerce and then added the following block of code to the template file page-header.php located at in the templates folder in the root of the roots theme.

<?php if ( is_shop() ) {

    /** If the shop page, do not display page-title **/

} elseif ( is_product() ) {

    /** If a product page, do not display page-title **/

} else {
    /** If is any other page, display page-title **/
     the_title( '<h1 class="page-title">', '</h1>' );
}

I hope this helps someone.

like image 29
Bryan Sattler Avatar answered Nov 15 '22 07:11

Bryan Sattler