From 0901a4ecbc18ec8663705e2255e5e32a2816ad1d Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Mon, 11 Jan 2016 15:57:18 -0500 Subject: [PATCH] Add cat attr to shortcode for category slug name --- index.php | 6 ++++++ 1 file changed, 6 insertions(+) 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(); -- 2.17.1