All the following rules are created in WebAdmin > Virtual Hosts > {your_vhost} > Context.
Don't forget to restart the webserver.
- Context Type:
Static
- URI:
exp:^.*(ini|log|zip)$
<?php | |
class WC_Shipping_Simulator_Bundles_Integration { | |
public function __construct () { | |
add_filter( 'wc_shipping_simulator_product_needs_shipping', [ $this, 'needs_shipping' ], 10, 2 ); | |
add_filter( 'wc_shipping_simulator_package_validate_virtual_product', [ $this, 'validate_virtual_product' ], 10, 2 ); | |
} | |
/** |
<?php | |
add_action( 'login_head', 'lpb_login_page_custom_design', 99999 ); | |
function lpb_login_page_custom_design () { | |
?> | |
<style> | |
body.login, | |
#loginform { | |
background: #fff; | |
} |
function uuid() { | |
const s4 = () => Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); | |
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); | |
} | |
// usage | |
const id = uuid(); // example: 88c86c16-e5c4-af27-ef3e-ab2045faf976 |
<?php | |
function lpb_purge_product_images ( $id ) { | |
if ( ! function_exists( 'wc_get_product' ) ) return; // prevent fatal errors | |
$product = wc_get_product( $id ); | |
if ( ! $product ) return; | |
$image_id = $product->get_image_id(); | |
if ( $image_id ) { |
// Create a bookmark with the following code in the URL field: | |
javascript:(function(){var e=document.documentElement;!e.style.filter?e.style.filter='grayscale(1)':e.style.filter=''}()) |
<?php | |
/** | |
* @param \Throwable|string $err | |
* @param string $prefix | |
* @return string The error message | |
*/ | |
function log_critical ( $err, $prefix = '' ) { | |
if ( is_a( $err, \Throwable::class ) ) { | |
$error = $err->getMessage(); |
const $ = (selector, root = document) => root.querySelector(selector); | |
const $$ = (selector, root = document) => root.querySelectorAll(selector); | |
const on = (el, evt, cb, opts) => el.addEventListener(evt, cb, opts); | |
const once = (el, evt, cb) => el.addEventListener(evt, cb, { once: true }); | |
const off = (el, evt, cb) => el.removeEventListener(evt, cb); |
<?php | |
add_action( 'woocommerce_cart_coupon', 'lpb_woocommerce_empty_cart_button' ); | |
function lpb_woocommerce_empty_cart_button () { | |
$cart_url = add_query_arg( 'empty_cart', 'yes', wc_get_cart_url() ); | |
$label = 'Empty cart'; | |
echo '<a href="' . esc_url( $cart_url ) . '" class="button">' . $label . '</a>'; | |
} | |
add_action( 'wp_loaded', 'lpb_woocommerce_empty_cart_action', 20 ); |