Skip to content

Instantly share code, notes, and snippets.

View rotisoft's full-sized avatar

Tamas "RotiSoft" Rottenbacher rotisoft

View GitHub Profile
DELETE FROM wp_options WHERE option_name LIKE "%swift_performance%"
@rotisoft
rotisoft / woo_simple_or_variable.php
Last active January 16, 2018 13:22 — forked from trueqap/woo_simple_or_variable.php
WooCommerce simple or variable product
<?php
$product = new WC_Product( get_the_ID() ); // in function.php maybe...
if( $product->is_type( 'simple' ) ){
// a simple product
} elseif( $product->is_type( 'variable' ) ){
$send_time_rs = get_the_time('c');
$updated_time_rs = get_the_modified_time('c');
echo '<time class="published" style="display: none;" datetime="';
echo $send_time_rs;
echo '">';
echo $send_time_rs;
echo '</time> ';
if($send_time_rs!==$updated_time_rs) {
@rotisoft
rotisoft / gist:06002b0585f33fa45b4ab6a65d841d3b
Created October 23, 2017 11:15
WordPress srcset https redirect
function ssl_srcset( $sources ) {
foreach ( $sources as &$source ) {
$source['url'] = set_url_scheme( $source['url'], 'https' );
}
return $sources;
}
add_filter( 'wp_calculate_image_srcset', 'ssl_srcset' );
@rotisoft
rotisoft / gist:b713b635550dd74347c64c0783571ef8
Created October 23, 2017 09:14
Disable srcset for one thumbnail
add_filter( 'wp_calculate_image_srcset_meta', '__return_null' );
echo get_the_post_thumbnail( $page->ID, 'large' );
remove_filter( 'wp_calculate_image_srcset_meta', '__return_null' );