diff --git a/app/API/Shortcodes/UserFavoritesShortcode.php b/app/API/Shortcodes/UserFavoritesShortcode.php index 3e07d27..5393c51 100644 --- a/app/API/Shortcodes/UserFavoritesShortcode.php +++ b/app/API/Shortcodes/UserFavoritesShortcode.php @@ -32,6 +32,8 @@ private function setOptions($options) 'site_id' => '', 'include_links' => 'true', 'post_types' => '', + 'taxonomy' => '', + 'terms' => '', 'include_buttons' => 'false', 'include_thumbnails' => 'false', 'thumbnail_size' => 'thumbnail', @@ -47,7 +49,20 @@ private function parsePostTypes() { if ( $this->options['post_types'] == "" ) return; $post_types = explode(',', $this->options['post_types']); - $this->filters = ['post_type' => $post_types]; + $this->filters['post_type'] = $post_types; + } + + /** + * Parse Taxonomy and terms + */ + private function parseTaxonomyAndTerms() + { + if ( $this->options['taxonomy'] == "" || $this->options['terms'] == "" ) return; + $this->filters['terms'] = [ + $this->options['taxonomy'] => [ + $this->options['terms'] + ] + ]; } /** @@ -58,6 +73,7 @@ public function renderView($options) { $this->setOptions($options); $this->parsePostTypes(); + $this->parseTaxonomyAndTerms(); $this->options['user_id'] = ( $this->options['user_id'] == "" ) ? null : intval($this->options['user_id']); $this->options['site_id'] = ( $this->options['site_id'] == "" ) ? null : intval($this->options['site_id']); @@ -80,4 +96,5 @@ public function renderView($options) $this->options['no_favorites'] ); } -} \ No newline at end of file +} +