Skip to content

Commit

Permalink
Control the qty of items to output
Browse files Browse the repository at this point in the history
  • Loading branch information
elvismdev committed Jul 9, 2015
1 parent 589c6fe commit 7ad27ba
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions woocommerce-products-by-custom-tax.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ function wpbct_shortcode( $atts, $content = null ) {
'tax_name' => '', // Required
'tax_tags' => '', // Required
'columns' => '4', // Optional
'template' => 'product' // Optional
'template' => 'product', // Optional
'qty' => '10' // Optional
), $atts));

if ( $tax_name === '' || $tax_tags === '' ) return '';
Expand All @@ -44,7 +45,8 @@ function wpbct_shortcode( $atts, $content = null ) {

$args = array(
'post_type' => 'product',
$tax_name => $tax_tags
'posts_per_page' => sanitize_text_field( $qty ),
$tax_name => sanitize_text_field( $tax_tags )
);

$products = new WP_Query( $args );
Expand Down

0 comments on commit 7ad27ba

Please sign in to comment.