Last active
August 29, 2015 14:16
-
-
Save AWMooreCO/4378eea93fc8ac5149a5 to your computer and use it in GitHub Desktop.
Merch Product Catalog Fixes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.woocommerce.archive ul.products li.product h3, | |
.woocommerce ul.products li.product h3 { | |
top: .25em; | |
color: #616671; | |
} | |
.woocommerce.archive ul.products li.product { | |
margin-bottom: 2.5em; | |
} | |
.woocommerce ul.products li.product .price { | |
top: 0em; | |
} | |
.detailsBtn { | |
top: 8em; | |
position: relative; | |
} | |
.detailsBtn span.sku { | |
display: table; | |
position: relative; | |
margin: 0 auto; | |
top: 2em; | |
font-size: 0.75em; | |
} | |
.site-footer .textwidget .woocommerce ul.products li figure, .sidebar-menu .textwidget .woocommerce ul.products li figure { | |
margin: 0 auto; | |
} | |
.site-footer .textwidget .woocommerce ul.products li a h3, .sidebar-menu .textwidget .woocommerce ul.products li a h3 { | |
color: white; /* Note: This should probably be controlled by the theme... */ | |
font-size:0.875rem; | |
} | |
@media only screen and (max-width: 40em) { | |
.woocommerce ul.products li.product h3 { | |
top: 0em !important; | |
padding: 0.25em 0; | |
} | |
.detailsBtn { | |
top: 0em; | |
position: relative; | |
} | |
.detailsBtn span.sku { | |
top: 0.5em; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The template for displaying product content within loops. | |
* | |
* Override this template by copying it to yourtheme/woocommerce/content-product.php | |
* | |
* @author WooThemes | |
* @package WooCommerce/Templates | |
* @version 1.6.4 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; // Exit if accessed directly | |
} | |
global $product, $woocommerce_loop; | |
// Store loop count we're currently on | |
if ( empty( $woocommerce_loop['loop'] ) ) | |
$woocommerce_loop['loop'] = 0; | |
// Store column count for displaying the grid | |
if ( empty( $woocommerce_loop['columns'] ) ) | |
$woocommerce_loop['columns'] = apply_filters( 'loop_shop_columns', 4 ); | |
// Ensure visibility | |
if ( ! $product || ! $product->is_visible() ) | |
return; | |
// Increase loop count | |
$woocommerce_loop['loop']++; | |
// Extra post classes | |
$classes = array(); | |
if ( 0 == ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] || 1 == $woocommerce_loop['columns'] ) | |
$classes[] = 'first'; | |
if ( 0 == $woocommerce_loop['loop'] % $woocommerce_loop['columns'] ) | |
$classes[] = 'last'; | |
?> | |
<li <?php post_class( $classes ); ?>> | |
<?php do_action( 'woocommerce_before_shop_loop_item' ); ?> | |
<a href="<?php the_permalink(); ?>"> | |
<figure> | |
<?php | |
/** | |
* woocommerce_before_shop_loop_item_title hook | |
* | |
* @hooked woocommerce_show_product_loop_sale_flash - 10 | |
* @hooked woocommerce_template_loop_product_thumbnail - 10 | |
*/ | |
do_action( 'woocommerce_before_shop_loop_item_title' ); | |
?> | |
<figcaption class="clearfix"> | |
<div class="detailsBtn"> | |
<?php | |
/** | |
* woocommerce_after_shop_loop_item_title hook | |
* | |
* @hooked woocommerce_template_loop_rating - 5 #removed | |
* @hooked woocommerce_template_loop_price - 10 #removed | |
* @hooked get_sku #added | |
*/ | |
do_action( 'woocommerce_after_shop_loop_item_title' ); | |
?> | |
</div> | |
<?php | |
/** | |
* woocommerce_after_shop_loop_item hook | |
* | |
* @hooked woocommerce_template_loop_add_to_cart - 10 | |
*/ | |
do_action( 'woocommerce_after_shop_loop_item' ); | |
?> | |
</figure> | |
<a href="<?php the_permalink(); ?>"> | |
<h3><?php the_title(); ?></h3> | |
</a> | |
</a> | |
</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The template for displaying product category thumbnails within loops. | |
* | |
* Override this template by copying it to yourtheme/woocommerce/content-product_cat.php | |
* | |
* @author WooThemes | |
* @package WooCommerce/Templates | |
* @version 1.6.4 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; // Exit if accessed directly | |
} | |
global $woocommerce_loop; | |
// Store loop count we're currently on | |
if ( empty( $woocommerce_loop['loop'] ) ) | |
$woocommerce_loop['loop'] = 0; | |
// Store column count for displaying the grid | |
if ( empty( $woocommerce_loop['columns'] ) ) | |
$woocommerce_loop['columns'] = apply_filters( 'loop_shop_columns', 4 ); | |
// Increase loop count | |
$woocommerce_loop['loop']++; | |
?> | |
<li class="product-category product<?php | |
if ( ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] == 0 || $woocommerce_loop['columns'] == 1 ) | |
echo ' first'; | |
if ( $woocommerce_loop['loop'] % $woocommerce_loop['columns'] == 0 ) | |
echo ' last'; | |
?>"> | |
<?php do_action( 'woocommerce_before_subcategory', $category ); ?> | |
<a href="<?php echo get_term_link( $category->slug, 'product_cat' ); ?>"> | |
<figure> | |
<?php | |
/** | |
* woocommerce_before_subcategory_title hook | |
* | |
* @hooked woocommerce_subcategory_thumbnail - 10 | |
*/ | |
do_action( 'woocommerce_before_subcategory_title', $category ); | |
?> | |
<figcaption class="clearfix"> | |
<?php | |
/** | |
* woocommerce_after_subcategory_title hook | |
*/ | |
do_action( 'woocommerce_after_subcategory_title', $category ); | |
?> | |
<div class="detailsBtn"> | |
<span><a class="button" href="<?php echo get_term_link( $category->slug, 'product_cat' ); ?>"><?php _e('View Products','merch');?> →</a></span> | |
</div> | |
</figcaption> | |
</figure> | |
<a href="<?php echo get_term_link( $category->slug, 'product_cat' ); ?>"> | |
<h3> | |
<?php | |
echo $category->name; | |
if ( $category->count > 0 ) | |
echo apply_filters( 'woocommerce_subcategory_count_html', ' <mark class="count">(' . $category->count . ')</mark>', $category ); | |
?> | |
</h3> | |
</a> | |
</a> | |
<?php do_action( 'woocommerce_after_subcategory', $category ); ?> | |
</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php global $product; | |
if ( function_exists( 'is_woocommerce' ) ) { | |
/** | |
* Remove Breadcrumbs | |
*/ | |
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20); | |
/** | |
* Change to 3 columns | |
*/ | |
add_filter('loop_shop_columns', 'merch_loop_columns'); | |
if (!function_exists('merch_loop_columns')) { | |
function merch_loop_columns() { | |
return 3; | |
} | |
} | |
/** | |
* Remove Ratings | |
*/ | |
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5); | |
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 ); | |
/** | |
* Remove Add to Cart button and add Product Button | |
*/ | |
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10); | |
add_action('woocommerce_after_shop_loop_item_title', 'merch_shop_button', 10); | |
add_action('woocommerce_after_shop_loop_item_title', 'shop_sku'); | |
function shop_sku(){ | |
global $product; | |
echo '<span itemprop="productID" class="sku">SKU: ' . $product->sku . '</span>'; | |
} | |
function merch_shop_button() { ?> | |
<span><a class="button" href="<?php the_permalink(); ?>"><?php _e('Details','merch');?> →</a></span> | |
<?php } | |
} // end function check is_woocommerce |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment