Docker info:
docker info
List Images:
//Override woocommerce product categories widgets | |
add_action( 'widgets_init', 'floweb_override_woocommerce_widgets', 15 ); | |
function floweb_override_woocommerce_widgets() { | |
// Ensure our parent class exists to avoid fatal error | |
if ( class_exists( 'WC_Widget_Cart' ) ) { | |
unregister_widget( 'WC_Widget_Cart' ); | |
require get_template_directory() . '/functions/custom-widgets/floweb-class-wc-widget-cart.php'; | |
register_widget( 'Floweb_WC_Widget_Cart' ); | |
} | |
} |
//This command must occur after you create your tracker object and before you use any of the enhanced ecommerce specific functionality. | |
ga('require', 'ec'); |
<?php | |
if ( ! function_exists( 'wc_rest_get_product_images' ) ) { | |
add_filter( 'woocommerce_rest_prepare_product_object', 'wc_rest_get_product_images', 10, 2 ); | |
/** | |
* Get the images for a product or product variation | |
* and returns all image sizes. | |
* | |
* @param WP_REST_Request $request Request object. | |
* @param WC_Product|WC_Product_Variation $product Product instance. |
<?php | |
/* | |
* THE FILTER | |
* | |
*/ | |
function custom_responsive_image_sizes($sizes, $img_name, $attachment_id) { | |
$sizes = wp_get_attachment_image_sizes($attachment_id, 'original'); | |
$meta = wp_get_attachment_metadata($attachment_id); | |
$width = $meta['width']; |
<?php | |
$args = array( | |
'post_type' => array( 'product' ), | |
'meta_key' => 'total_sales', | |
'orderby' => 'meta_value_num', | |
'order' => 'desc', | |
'posts_per_page' => 5 | |
); | |
$popular_products = new WP_Query( $args ); |
<?php | |
/** | |
* Hook: Empty cart before adding a new product to cart WITHOUT throwing woocommerce_cart_is_empty | |
*/ | |
add_action ('woocommerce_add_to_cart', 'lenura_empty_cart_before_add', 0); | |
function lenura_empty_cart_before_add() { | |
global $woocommerce; | |
// Get 'product_id' and 'quantity' for the current woocommerce_add_to_cart operation |
//Woocommerce Checkout JS events | |
$( document.body ).trigger( 'init_checkout' ); | |
$( document.body ).trigger( 'payment_method_selected' ); | |
$( document.body ).trigger( 'update_checkout' ); | |
$( document.body ).trigger( 'updated_checkout' ); | |
$( document.body ).trigger( 'checkout_error' ); | |
//Woocommerce cart page JS events | |
$( document.body ).trigger( 'wc_cart_emptied' ); | |
$( document.body ).trigger( 'update_checkout' ); |
<?php | |
// Get headers for 100 unique random domains with get_headers() and cURL to determine which is faster. | |
/* | |
TL;DR -> cURL is significantly faster. | |
get_headers (GET) vs cURL: | |
Execution time : 139.95884609222 seconds | |
Execution time : 65.998840093613 seconds |
<div id="google_translate_element"></div> | |
<script> | |
function googleTranslateElementInit() { | |
new google.translate.TranslateElement({ | |
pageLanguage: 'en' | |
}, 'google_translate_element'); | |
} | |
</script> | |
<script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> |