This file contains hidden or 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(document).ready( function($) { | |
var calculator = new variation_calculator(product_attributes, product_variations_flat, my_all_set_callback, my_not_all_set_callback); | |
calculator.reset_selected(); | |
calculator.reset_current(); | |
function my_not_all_set_callback() { | |
// Reset image | |
var img = $('div.images img:eq(0)'); | |
var link = $('div.images a.zoom:eq(0)'); |
This file contains hidden or 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_shortcode('trial_contents', 'do_trial_contents'); | |
function do_trial_contents($atts='') { | |
$content = ''; | |
if (trial_check_cookie()) { | |
$content = trial_get_the_download_link(); | |
} else { | |
if (!empty($_POST) && isset($_POST['action']) && $_POST['action'] == 'trial-signup'){ | |
This file contains hidden or 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
global $post; | |
if (basename( get_page_template() ) != 'some-template.php') { | |
$featured_image_post = get_featured_recursive($post); | |
if ($featured_image_post != null) { | |
$featured_image_src = wp_get_attachment_image_src(get_post_thumbnail_id($featured_image_post), 'single-post-thumbnail'); ?> | |
<img src="<?php echo $featured_image_src[0]; ?>" alt="<?php the_title(); ?>" /> | |
<?php } | |
else { | |
if (has_post_thumbnail()){ | |
//output the thumbnail normally |
This file contains hidden or 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
// Minimal YouTube & Vimeo embeds | |
function theme_oembed_get($url, $args = '') { | |
if (preg_match("/youtube.com\/watch\?v=([^&]+)/i", $url, $aMatch)) { | |
return '<iframe width="' . $args['width'] . '" height="' . $args['height'] . '" src="http://www.youtube.com/embed/' . $aMatch[1] . '?loop=1&modestbranding=1&rel=0&showinfo=0&autohide=1" frameborder="0" allowfullscreen></iframe>'; | |
} | |
if (preg_match("/youtube.com\/watch\?feature=player_embedded&v=([^&]+)/i", $url, $aMatch)) { | |
return '<iframe width="' . $args['width'] . '" height="' . $args['height'] . '" src="http://www.youtube.com/embed/' . $aMatch[1] . '?loop=1&modestbranding=1&rel=0&showinfo=0&autohide=1" frameborder="0" allowfullscreen></iframe>'; | |
} |
This file contains hidden or 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('woocommerce_single_product_summary', 'my_after_woocommerce_single_product_summary', 21); | |
function my_after_woocommerce_single_product_summary() { | |
global $post, $product; | |
if (is_object_in_term($post->ID, 'product_cat', array('tshirts'))) { | |
echo 'Your Custom Pricing Table'; | |
} | |
} |
This file contains hidden or 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
$nav = array( | |
array( | |
'item1', | |
'item2', | |
'item3' | |
), | |
array( | |
'item1', | |
'item2', | |
'item3' |
This file contains hidden or 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
function set_catalog_visibility_user_can_purchase($result, $product){ | |
$result = false; //set the default. | |
//create an array of roles and their assoicated categories. | |
$allowed = array( | |
'customer' => array( | |
'bakeware', | |
'appliances', | |
'category-1', | |
), |
This file contains hidden or 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 | |
/*-----------------------------------------------------------------------------------*/ | |
/* Custom Softwright Upcoming Events /* | |
/*-----------------------------------------------------------------------------------*/ | |
if( ! class_exists( 'sw_upc_events_widget' ) ) : | |
class sw_upc_events_widget extends WP_Widget { | |
function sw_upc_events_widget() { | |
$widget_ops = array( 'description' => __( 'Displays closest Upcoming Events by date' ), 'classname' => 'upcoming-event-widget' ); | |
$this->WP_Widget( 'upc_event_widget', __( 'Softwright Upcoming Events' ), $widget_ops ); |
This file contains hidden or 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 | |
/* | |
* Plugin Name: Example Modify Price | |
*/ | |
class Example_Modify_Price { | |
private static $instance; | |
public static function register() { | |
if (self::$instance == null) { |
This file contains hidden or 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
$amount = apply_filters('woocommerce_dynamic_pricing_get_rule_amount', $rule['amount'], $rule, $cart_item, $this); | |
switch ($rule['type']) { | |
case 'price_discount': | |
$adjusted = floatval($price) - floatval($amount); | |
$result = $adjusted >= 0 ? $adjusted : 0; | |
break; | |
case 'percentage_discount': | |
if ($amount > 1) { | |
$rule['amount'] = $amount / 100; |
OlderNewer