// Shortcode to display promo message anywhere add_shortcode( 'product_promo', 'tbpp_product_promo_shortcode' ); /** * Shortcode to display product promo message * Usage: [product_promo] or [product_promo id="123"] */ function tbpp_product_promo_shortcode( $atts ) { // Check if ACF is active if ( ! function_exists( 'get_field' ) ) { return ''; } // Parse shortcode attributes $atts = shortcode_atts( array( 'id' => get_the_ID(), // Default to current product ID ), $atts, 'product_promo' ); $product_id = intval( $atts['id'] ); // Check if we have a valid product ID if ( ! $product_id ) { return ''; } // Check if promo is active based on dates if ( ! tbpp_is_promo_active( $product_id ) ) { return ''; } // Get the promo message for the product $promo_message = get_field( 'promo_message', $product_id ); // If no promo message exists, return empty if ( empty( $promo_message ) ) { return ''; } // Get styling fields from ACF with fallbacks $promo_background_color = get_field( 'promo_background_color', $product_id ); $background_color = ! empty( $promo_background_color ) ? $promo_background_color : '#f5f5f5'; $promo_padding = get_field( 'promo_padding', $product_id ); $padding = ! empty( $promo_padding ) ? $promo_padding : '15px'; $promo_border_radius = get_field( 'promo_border_radius', $product_id ); $border_radius = ! empty( $promo_border_radius ) ? $promo_border_radius : '8px'; // Build the style string $style = sprintf( 'background-color: %s; padding: %s; margin-top: 15px; margin-bottom: 20px; border-radius: %s; font-weight: bold; text-align: center;', esc_attr( $background_color ), esc_attr( $padding ), esc_attr( $border_radius ) ); // Build and return the HTML $output = '
'; $output .= wp_kses_post( $promo_message ); $output .= '
'; return $output; } ``` ## How to Use the Shortcode ### 1. **On Product Pages (most common)** Add this shortcode anywhere in your product template or using a page builder: ``` [product_promo] ``` ### 2. **For Specific Products** If you want to show a specific product's promo on any page: ``` [product_promo id="123"]

KYORITSU 2117R AC Digital Clamp Meter – 1000A

 

Buy now form My Meter

The Kyoritsu KEW 2117R is a 1000A ACA True RMS Clamp Meter with 0.01A resolution on 60A range.

It is autoranging and has 33mm jaw size and also ACV, DCV, Resistance, Continuity and has non-contact AC voltage detection.

    Kyoritsu 2117R Datasheet

    Kyoritsu 2117R User Manual

 

announcement  EOFY specials It's that time of the year again - the end of financial year! And here at Rapid-Tech, we've got some amazing EOFY specials for all our customers.