jmccole83
12/20/2017 - 7:01 PM

Sage & WooCommerce | Duplicate header, footer & sidebar

Installing WooCommere to a site using the Sage theme causes shop pages to have duplicate content.

To resolve this, create several new files, header-shop.php, footer-shop.php and sidebar-shop.php.

This will remove both instances of the element.

You can then edit files with custom content to add required elements (e.g titles, breadcrumbs).

Example files below.

<?php if ( is_product() ):
    echo '<aside>';
        dynamic_sidebar( 'sidebar-shop-product' );
    echo '</aside>';
endif; ?>
<?php // this file is to stop duplicate footers - DO NOT EDIT ?>
<?php // this file is to stop duplicate headers - DO NOT EDIT ?>
<?php
  if ( function_exists('yoast_breadcrumb') ) {
      yoast_breadcrumb('
      <p id="breadcrumbs">','</p>'
    );
  }
?>