Skip to content

Instantly share code, notes, and snippets.

@warrendholmes
warrendholmes / gist:3135463
Created July 18, 2012 10:34
Add filter to load a template file for a specific category in WooCommerce
add_filter( 'template_include', 'woocommerce_add_template_loader_product_category' );
function woocommerce_add_template_loader_product_category(){
global $product;
foreach ( get_the_terms( $product->id, 'product_cat' ) as $key => $value) {
locate_template( 'single-product-' . $value->slug . '.php' ,true, $require_once = true) ;
}
<?php
echo "hell world";
?>
@warrendholmes
warrendholmes / gist:3360943
Created August 15, 2012 15:15
Get featured image directory path
$wp_upload_dir = wp_upload_dir();
$wp_upload_dir_basedir = $wp_upload_dir['basedir'];
$thumbnail = get_post_meta( get_post_thumbnail_id( $post_id ) , '_wp_attached_file', true );
$thumbnail_path = trailingslashit( $wp_upload_dir_basedir ) . $thumbnail;
* Feature – New input for shipping method title (as the customer sees it)
* Tweak – Made the currency DP rule apply to order totals for currencies which don’t have cent values https://github.com/woothemes/woocommerce/issues/1383
* Tweak – Made proceed to checkout button update totals too
* Tweak – Rewritten variation javascript to add scope. Please ensure that if you have a custom variable.php add to cart template, that you update them.
* Tweak – Classes for order info in my-account
* Tweak – Iconised order action buttons
* Tweak – Simplified order status markers
* Tweak – Product data tabs class change
* Tweak – Moved upsells above related products as they should have higher priority
* Tweak – Added utm_nooverride to improve tracking after paypal payment
[wooslider category="slide" slider_type="posts" overlay="natural" display_excerpt="false" id="4"]
[wooslider slider_type="attachments"]
@warrendholmes
warrendholmes / gist:6493474
Created September 9, 2013 09:33
Instagram Slideshows shortcode.
[wooslider slider_type="instagram"]
@warrendholmes
warrendholmes / Flexslider header
Created March 11, 2014 07:45
Embed the Flexslider script
<!-- Place somewhere in the <head> of your document -->
<link rel="stylesheet" href="flexslider.css" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="jquery.flexslider.js"></script>
<!-- Place somewhere in the <body> of your page -->
<div class="flexslider">
<ul class="slides">
<li>
<img src="slide1.jpg" />
</li>
<li>
<img src="slide2.jpg" />
</li>
<li>
<!-- Place in the <head>, after the three links -->
<script type="text/javascript" charset="utf-8">
$(window).load(function() {
$('.flexslider').flexslider();
});
</script>