View gist:9d9652688c4215700794
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
jQuery(function($){ | |
$('.thumbnails>a>img').click(function(e){ | |
e.stopPropagation(); | |
$('.woocommerce-main-image img').attr('src', $(this).attr('src').replace('-87x87','-564x564')); | |
return false; | |
}); | |
}); |
View WooCommerce-custom-product-count.php
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
//Set products per row | |
add_filter( 'loop_shop_columns', create_function( '$cols', 'return 3;' ), 20 ); | |
//Set products per page | |
add_filter( 'loop_shop_per_page', create_function( '$num', 'return 12;' ), 20 ); | |
View gist:20718fd4162be0df32d7
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
$product_ids_raw = $wpdb->get_results( | |
"SELECT wp_posts.ID, wp_posts.post_parent | |
FROM wp_posts | |
INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) | |
INNER JOIN wp_postmeta AS mt1 ON (wp_posts.ID = mt1.post_id) | |
WHERE | |
wp_posts.post_status = 'publish' | |
AND (mt1.meta_key = '_sale_price_dates_to' AND mt1.meta_value >= ".time().") | |
GROUP BY wp_posts.ID |
View party.sh
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
#!/bin/bash | |
while : | |
do | |
eject | |
eject -t | |
done |
View gist:a9e725cb0b712aeac24a
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
add_filter('woocommerce_get_sale_price', 'my_custom_price', 99, 2); | |
add_filter('woocommerce_get_price', 'my_custom_price', 99, 2); | |
function my_custom_price( $price, $product ) | |
{ | |
//your logic for calculating the new price here | |
//Half price for VIP-customers | |
if( in_array('vip', get_userdata(get_current_user_id())->roles ) |
View gist:76830d0b283a09548bfb
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
add_filter('the_content', 'set_first_word_color', 10); | |
function set_first_word_color( $content ) | |
{ | |
$color = '#FF0000'; | |
$pos = strpos(ltrim($content), ' '); | |
$new_content = '<span style="color: '.$color.'"'.substr($content, 0, $pos).'</span>'.substr($content, $pos); |
View gist:9593f6ca25a84a7ce962
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
SET FOREIGN_KEY_CHECKS = 0; | |
TRUNCATE TABLE `catalog_product_bundle_option`; | |
TRUNCATE TABLE `catalog_product_bundle_option_value`; | |
TRUNCATE TABLE `catalog_product_bundle_selection`; | |
TRUNCATE TABLE `catalog_product_entity_datetime`; | |
TRUNCATE TABLE `catalog_product_entity_decimal`; | |
TRUNCATE TABLE `catalog_product_entity_gallery`; |
View get_current_post_type.php
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 | |
/** | |
* Gets the current global post type if one is set | |
*/ | |
function x_get_current_post_type() { | |
global $post, $typenow, $current_screen; | |
if( $post && $post->post_type ) | |
$post_type = $post->post_type; | |
elseif( $typenow ) |
View purchasable-by-category.php
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
add_action('wp', 'prefix_theme_setup', 99); | |
function prefix_theme_setup() | |
{ | |
add_filter( 'woocommerce_is_purchasable', 'prefix_is_purchasable', 20, 2); | |
} | |
function prefix_is_purchasable($purchasable, $product) |
View wpfcwc.conf
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
# | |
set $skip_cache 0; | |
# POST requests and URL with a query string should always go to php | |
if ($request_method = POST) { | |
set $skip_cache 1; | |
} | |
if ($query_string != "") { |
OlderNewer