Skip to content

Instantly share code, notes, and snippets.

@braddalton
Last active August 29, 2015 13:56
Show Gist options
  • Save braddalton/9009948 to your computer and use it in GitHub Desktop.
Save braddalton/9009948 to your computer and use it in GitHub Desktop.
Add Woo Commerce Support To The Twenty Fourteen Default Theme for WordPress
/**
* Easier Option http://wpsites.net/best-plugins/benefits-of-integrating-customizing-woocommerce-with-genesis-themes/
*/
// Remove stock wrappers
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
// Add 2014 compatible wrappers
add_action( 'woocommerce_before_main_content', 'wc_twentyfourteen_wrapper', 10 );
add_action( 'woocommerce_after_main_content', 'wc_twentyfourteen_wrapper_close', 10 );
function wc_twentyfourteen_wrapper() {
echo '<div id="primary" class="content-area"><div id="content" role="main" class="site-content twentyfourteen"><div class="tfwc">';
}
function wc_twentyfourteen_wrapper_close() {
echo '</div></div></div>';
get_sidebar( 'content' );
}
// Add 2014 compatibility css
add_action( 'wp_footer', 'wc_twentyfourteen_css' );
function wc_twentyfourteen_css() {
if ( is_shop() || is_product_category() || is_product_taxonomy() || is_product_tag() || is_product() ) {
?>
<style type="text/css">
.twentyfourteen .tfwc {
padding: 12px 10px 0;
max-width: 474px;
margin: 0 auto;
}
.twentyfourteen .tfwc .entry-summary {
padding: 0 !important;
margin: 0 0 1.618em !important;
}
.full-width .twentyfourteen .tfwc {
margin-right: auto;
}
@media screen and (min-width: 673px) {
.twentyfourteen .tfwc {
padding-right: 30px;
padding-left: 30px;
}
}
@media screen and (min-width: 1040px) {
.twentyfourteen .tfwc {
padding-right: 15px;
padding-left: 15px;
}
}
@media screen and (min-width: 1110px) {
.twentyfourteen .tfwc {
padding-right: 30px;
padding-left: 30px;
}
}
@media screen and (min-width: 1218px) {
.twentyfourteen .tfwc {
margin-right: 54px;
}
}
</style>
<?php
}
}
add_theme_support( 'woocommerce' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment