Lazy load YouTube videos in WordPress with Shortcode (copy)

function yt_shortcode_function( $atts = array() ) { // set up default parameters extract(shortcode_atts(array( ‘id’ => ‘test’ ), $atts)); return ‘ <iframe width="560" height="315" src="https://youtu.be/'. $id .'?autoplay=1" srcdoc=" * { padding:0; margin:0; overflow:hidden; } html,body { height:100%; } img,span { position:absolute;…Continue reading

Get Post Terms with [g9_post_terms] Shortcode

function g9_get_post_terms() { global $post; ob_start(); $taxonomy_name = ‘category’; // Taxonomy name $terms = get_the_terms($post->ID, $taxonomy_name); if ($terms) : $term_links = array(); foreach ($terms as $term) { $term_links[] = ‘Continue reading

Show SKU in Cart

function g9_sku_cart_page($item_name, $cart_item, $cart_item_key) { // The WC_Product object $product = $cart_item[‘data’]; // Get the SKU $sku = $product->get_sku(); // When sku doesn’t exist if (empty($sku)) return $item_name; // Add the sku $item_name .= ‘‘ . __(“SKU: “, “woocommerce”) .…Continue reading