This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get WooCommerce product attributes by ID via shortcode: [iw_product_attributes id=''] | |
function iw_product_attributes_shortcode( $atts ) { | |
$atts = shortcode_atts( array( | |
'id' => null, | |
), $atts, 'bartag' ); | |
if( intval( $atts['id'] ) > 0 && function_exists( 'wc_get_product' ) ){ | |
$_product = wc_get_product( $atts['id'] ); | |
if( $_product->has_attributes() ){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get WooCommerce random product ratings via shortcode: [iw_random_ratings] | |
function iw_random_ratings_shortcode( $atts ) { | |
extract( shortcode_atts( array( | |
'author__not_in' => '', | |
'number' => '5', | |
'author' => 'show', | |
'object' => 'show' | |
), $atts ) ); | |
$args = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get WordPress recent comments via shortcode: [iw_recent_comments] | |
function iw_recent_comments_shortcode( $atts ) { | |
extract( shortcode_atts( array( | |
'author__not_in' => '', | |
'number' => '8', | |
'order' => 'DESC', | |
'avatar' => 'show', | |
'author' => 'show', | |
'date' => 'show', | |
'object' => 'show', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Remove the default WooCommerce 3 JSON-LD structured data format | |
function iw_remove_output_structured_data() { | |
remove_action( 'wp_footer', array( WC()->structured_data, 'output_structured_data' ), 10 ); // Frontend pages | |
remove_action( 'woocommerce_email_order_details', array( WC()->structured_data, 'output_email_structured_data' ), 30 ); // Emails | |
} | |
add_action( 'init', 'iw_remove_output_structured_data' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global $product; | |
$sd_product_name = $product->get_title(); | |
$sd_product_image = get_the_post_thumbnail_url(); | |
$sd_product_description = substr(wp_strip_all_tags($product->get_post_data()->post_excerpt),0,107) . '...'; | |
$sd_product_sku = $product->get_sku(); | |
$sd_product_rating_value = $product->get_average_rating(); | |
$sd_product_rating_count = $product->get_rating_count(); | |
$sd_product_currency = get_woocommerce_currency(); | |
$sd_product_price = $product->get_price(); | |
$sd_product_stock = $product->get_stock_status(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (is_single()) { | |
$sd_title = esc_html(get_the_title()); | |
$sd_headline = substr(wp_strip_all_tags(get_the_excerpt()),0,107) . '...'; | |
$sd_image = get_the_post_thumbnail_url(); | |
$sd_permalink = esc_url(get_permalink()); | |
$sd_published = get_the_date('c'); | |
$sd_modified = get_the_modified_date('c'); | |
$sd_author = esc_html(get_the_author()); | |
$sd_organization = get_bloginfo('name'); | |
$sd_modified = get_the_modified_date('c'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get WooCommerce store address city via shortcode: [iw_store_address_city] | |
function iw_store_address_city_shortcode() { | |
$base_address = get_option( 'woocommerce_store_city', '' ); | |
return apply_filters( 'woocommerce_countries_base_address', $base_address ); | |
} | |
add_shortcode( 'iw_store_address_city', 'iw_store_address_city_shortcode' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get WooCommerce store address postcode via shortcode: [iw_store_address_postcode] | |
function iw_store_address_postcode_shortcode() { | |
$base_address = get_option( 'woocommerce_store_postcode', '' ); | |
return apply_filters( 'woocommerce_countries_base_address', $base_address ); | |
} | |
add_shortcode( 'iw_store_address_postcode', 'iw_store_address_postcode_shortcode' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get WooCommerce store address street via shortcode: [iw_store_address_street] | |
function iw_store_address_street_shortcode() { | |
$base_address = get_option( 'woocommerce_store_address', '' ); | |
return apply_filters( 'woocommerce_countries_base_address', $base_address ); | |
} | |
add_shortcode( 'iw_store_address_street', 'iw_store_address_street_shortcode' ); |
NewerOlder