Add L/W/H Labels in Product Additional Information Dimensions

add_filter( ‘woocommerce_format_dimensions’, ‘rd_format_dimensions_with_labels’, 10, 2 ); function rd_format_dimensions_with_labels( $dimension_string, $dimensions ) { if ( empty( $dimensions ) || ! is_array( $dimensions ) ) { return $dimension_string; } $labels = [ ‘L’, ‘W’, ‘H’ ]; $values = array_values( $dimensions ); $unit…Continue reading

Untitled Snippet

const crypto = require(‘crypto’); const secret = ‘•••••••••’; // Your verification secret key const userId = current_user.id // A string UUID to identify your user const hash = crypto.createHmac(‘sha256’, secret).update(userId).digest(‘hex’);Continue reading

Add ‘Logged-In Admin’ Rule Option to ACF Pro

// 1. Register the rule under the ‘User’ group add_filter(‘acf/location/rule_types’, function($choices) { $choices[‘User’][‘logged_in_admin’] = ‘Logged-In Admin’; return $choices; }); // 2. Limit to only valid operators for dropdown-based values add_filter(‘acf/location/rule_operators/logged_in_admin’, function($choices) { return [ ‘==’ => ‘is equal to’, ‘!=’…Continue reading

Add Product Listing Parameters to Google Product Feed

function lw_woocommerce_gpf_feed_item_google( $feed_item, $product ) { $product_name = $product->get_name(); $label = $product_name . ‘ Shopping Product Card’; $feed_item->purchase_link .= ‘?utm_content=’ . rawurlencode( $label ); return $feed_item; } add_filter( ‘woocommerce_gpf_feed_item_google’, ‘lw_woocommerce_gpf_feed_item_google’, 10, 2 );Continue reading

PRINT WP POST

add_filter(‘the_content’, function($content) { if (!is_single()) return $content; $button = ‘ Print Post ‘; $pos = strpos($content, ‘ ‘); if ($pos !== false) { return substr_replace($content, $button, $pos + 4, 0); } return $button . $content; });Continue reading