Skip to content

Instantly share code, notes, and snippets.

View iWebbers's full-sized avatar

Dennis Dallau iWebbers

View GitHub Profile
// 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(
// 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() ){