From: Steve Sutton Date: Mon, 11 Jan 2016 20:57:18 +0000 (-0500) Subject: Add cat attr to shortcode for category slug name X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=0901a4ecbc18ec8663705e2255e5e32a2816ad1d;p=WP-Plugins%2Fmichsci-products.git Add cat attr to shortcode for category slug name --- diff --git a/index.php b/index.php index 0b23f6f..3cbceb6 100644 --- a/index.php +++ b/index.php @@ -438,6 +438,12 @@ function michsci_shortcode($atts) extract( shortcode_atts( array( 'limit' => '10' ), $atts ) ); ob_start(); + if ( isset($atts['cat']) ) { + if ($prodCategory = get_term_by( 'slug', $atts['cat'], MICHSCI_CATEGORY_NAME ) ) { + $_REQUEST[MICHSCI_CATEGORY_NAME] = $prodCategory->term_id; + } + } + echo '
Search Products
'; echo michsci_get_terms_dropdown();