Skip to content

Instantly share code, notes, and snippets.

@Frique
Frique / gist:6212779
Created August 12, 2013 16:53
IE specific HTML classes
<!--[if lte IE 6]><html class="ie ie6 lte9 lte8 lte7"><![endif]-->
<!--[if IE 7]><html class="ie ie7 lte9 lte8 lte7"><![endif]-->
<!--[if IE 8]><html class="ie ie8 lte9 lte8"><![endif]-->
<!--[if IE 9]><html class="ie ie9 lte9"><![endif]-->
<!--[if gt IE 9]><html><![endif]-->
<!--[if !IE]><!--><html><!--<![endif]-->
@Frique
Frique / functions.php
Last active December 29, 2018 16:50
wcssm woocs support
// Scheduled Sale Manager for WooCommerce support for Currency Switcher for WooCommerce by RealMag777
// Prevents incorrect sale price when the "Advanced > Is multiple allowed" option is enabled.
if ( class_exists( 'WOOCS' ) ) {
global $WOOCS;
add_filter( 'woocommerce_product_get_price', function( $price, $product_object ) {
global $WOOCS;
$is_manual_sale = $product_object->get_sale_price( 'edit' ) && $product_object->get_sale_price( 'edit' ) == WCSSM::get_product_sale_price( $product_object->get_sale_price( 'edit' ), $product_object );
@Frique
Frique / functions.php
Created January 3, 2019 00:13
WCSSM: Do not apply sales to out-of-stock products
add_filter( 'wcssm-applicable-sales', function( $value, $product ) {
if ( ! $product->is_in_stock() ) {
$value = null;
}
return $value;
}, 10, 2 );
@Frique
Frique / functions.php
Created January 13, 2019 13:58
Clientside: conditionally disable admin theming
add_filter( 'clientside-is-themed', function( $bool ) {
if ( $_GET['page'] === 'my-admin-page' ) {
$bool = false;
}
return $bool;
} );
@Frique
Frique / functions.php
Created April 18, 2021 12:30
WCSSM: Support for the Woodmart Countdown timer
// Force the native sale-price-end-date overwrite
add_filter( 'get_post_metadata', 'wcssm_woodmart_filter_sale_price_meta', 11, 4 );
function wcssm_woodmart_filter_sale_price_meta( $value, $object_id, $meta_key, $single ) {
if ( $meta_key === '_sale_price_dates_to' ) {
remove_filter( 'get_post_metadata', 'wcssm_woodmart_filter_sale_price_meta', 11, 4 );
if ( $sale = WCSSM::get_applicable_sale( $object_id ) ) {
$schedule = array_shift( $sale['schedule'] );
@Frique
Frique / functions.php
Created April 18, 2021 12:33
WCSSM: Force the native sale-price overwrite
// Force the native sale-price overwrite
add_filter( 'get_post_metadata', 'wcssm_markus_filter_sale_price_meta', 11, 4 );
function wcssm_markus_filter_sale_price_meta( $value, $object_id, $meta_key, $single ) {
if ( $meta_key === '_sale_price' ) {
remove_filter( 'get_post_metadata', 'wcssm_markus_filter_sale_price_meta', 11, 4 );
if ( $sale = WCSSM::get_applicable_sale( $object_id ) ) {
$value = $sale['price'];