if( ! function_exists('product_service') ) { // Add Shortcode function product_service( $atts ) { global $woocommerce_loop; // Attributes $atts = shortcode_atts( array( 'columns' => '4', 'limit' => '20', ), $atts, 'products_service' ); $woocommerce_loop['columns'] = $atts['columns']; // The WP_Query $products = new WP_Query( array ( 'post_type' => 'product', 'post_status' => 'publish', 'posts_per_page' => $atts['limit'], 'meta_key' => '_wss_type', 'meta_value' => array('yes'), //'meta_value' => array('yes'), 'meta_compare' => 'IN' //'meta_compare' => 'NOT IN' )); ob_start(); if ( $products->have_posts() ) { ?> have_posts() ) : $products->the_post(); ?> There is no results.

"; } woocommerce_reset_loop(); wp_reset_postdata(); return '
' . ob_get_clean() . '
'; } add_shortcode( 'products_service', 'product_service' ); }