Skip to content

Instantly share code, notes, and snippets.

@ChromeOrange
ChromeOrange / functions.php
Created August 9, 2012 23:51
WooThemes Home Work Week 1 (09/08/2012)
<?php
/**
* Change the separator in the breadcrumb to a pipe if on single posts screens,
* and display the post's categories in the single post breadcrumb in the simplest way possible.
* Both of these should be done in a single filter as well (because the customer has requested it).
*
* Code below tested in Simplicity Theme
**/
@ChromeOrange
ChromeOrange / functions.php
Created August 18, 2012 01:51
Custom Version of standard WooCommerce Recent Products
<?php
add_shortcode('custom_recent_products', 'custom_woocommerce_recent_products');
/**
* Recent Products shortcode with custom styles
**/
function custom_woocommerce_recent_products( $atts ) {
global $woocommerce_loop;
@ChromeOrange
ChromeOrange / functions.php
Created August 20, 2012 10:21
Managing WooCommerce Product Tabs
<?php
/**
* Standard Tab Code from woocommerce-hooks.php
*/
/* Product page tabs */
add_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 10 );
add_action( 'woocommerce_product_tabs', 'woocommerce_product_attributes_tab', 20 );
add_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30 );
add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_description_panel', 10 );
@ChromeOrange
ChromeOrange / functions.php
Created August 22, 2012 09:08
Custom Add To Cart Messages
<?php
/**
* Custom Add To Cart Messages
* Add this to your theme functions.php file
**/
add_filter( 'woocommerce_add_to_cart_message', 'custom_add_to_cart_message' );
function custom_add_to_cart_message() {
global $woocommerce;
// Output success messages
@ChromeOrange
ChromeOrange / functions.php
Created August 23, 2012 11:29
Move Address Fields
add_filter('woocommerce_billing_fields', 'custom_reorder_address_fields');
function custom_reorder_address_fields( $fields ) {
$billing_first_name = $fields['billing']['billing_first_name'];
$billing_last_name = $fields['billing']['billing_last_name'];
$billing_company = $fields['billing']['billing_company'];
$billing_address_1 = $fields['billing']['billing_address_1'];
$billing_address_2 = $fields['billing']['billing_address_2'];
$billing_city = $fields['billing']['billing_city'];
$billing_postcode = $fields['billing']['billing_postcode'];
@ChromeOrange
ChromeOrange / functions.php
Created August 23, 2012 12:32
Move Tabs Around
<?php
add_action( 'widgets_init' , 'custom_remove_tabs' , 10 );
function custom_remove_tabs() {
global $woocommerce_product_enquiry_form,$WooCommerce_Video_Product_Tab,$WoocommerceCustomProductTabsLite;
remove_action('woocommerce_product_tabs', array( &$WooCommerce_Video_Product_Tab,'video_product_tabs'), 25);
remove_action('woocommerce_product_tab_panels', array( &$WooCommerce_Video_Product_Tab,'video_product_tabs_panel'), 25);
remove_action('woocommerce_product_tabs', 'video_product_tabs', 25);
remove_action('woocommerce_product_tab_panels', 'video_product_tabs_panel', 25);
@ChromeOrange
ChromeOrange / single-product-reviews.php
Created August 23, 2012 14:33
Limit the number of approved reviews
<?php global $woocommerce; ?>
<?php if ( comments_open() ) : ?><div id="reviews"><?php
// Set this to the maximum number of reviews you would like
$max_reviews = 10;
echo '<div id="comments">';
$count = $wpdb->get_var("
SELECT COUNT(meta_value) FROM $wpdb->commentmeta
<?php
if ( in_category( 'himalayan' ) ) :
echo
"<div class='woo-sc-hr'></div>
<div class='story_blocks'>
<div class='twocol-one'>
<a href='#'>Himalayan</a>
</div>
<div class='twocol-one last'>
<a href='#'><img src='http://gator685.hostgator.com/~crawles/wp-content/uploads/assets/merino-story.png' /></a>
@ChromeOrange
ChromeOrange / functions.php
Created August 31, 2012 08:18
Sold Out Shortcode
<?php
add_shortcode('soldoutproducts', 'custom_woocommerce_soldout_products');
/**
* Recent Products shortcode with custom styles
**/
function custom_woocommerce_soldout_products( $atts ) {
global $woocommerce_loop;
@ChromeOrange
ChromeOrange / functions.php
Created August 31, 2012 12:20
Change Single Product Tab Titles and Headings
<?php
/**
* Tab Title filters do not work with WooCommerce 1.6.5.1 or lower
* Please download this zip file http://cl.ly/2Y3S3D3M3C23 , extract the 3 files and copy them to :
* wp-content/themes/YOUR_THEME/woocommerce/single-product/tabs/
**/
add_filter ( 'woocommerce_product_description_tab_title', 'custom_product_description_tab_title' ) ;
function custom_product_description_tab_title() {