From 042b19b71dded357c5a42ef506c38487c2664a63 Mon Sep 17 00:00:00 2001 From: w3b-beweb Date: Fri, 9 Sep 2022 18:25:22 +0200 Subject: [PATCH 1/2] Update UserFavoritesShortcode.php Added 2 arguments to the shortcode: - taxonomy - terms they use Favorites filters --- app/API/Shortcodes/UserFavoritesShortcode.php | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/app/API/Shortcodes/UserFavoritesShortcode.php b/app/API/Shortcodes/UserFavoritesShortcode.php index 6c7bde7..0107ea6 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(); if ( $this->options['user_id'] == "" ) $this->options['user_id'] = null; if ( $this->options['site_id'] == "" ) $this->options['site_id'] = null; @@ -80,4 +96,4 @@ public function renderView($options) $this->options['no_favorites'] ); } -} \ No newline at end of file +} From 644ceb2bfdb7655db314fdcbb818406a2a4714c4 Mon Sep 17 00:00:00 2001 From: w3b-beweb Date: Fri, 9 Sep 2022 18:32:45 +0200 Subject: [PATCH 2/2] Update UserFavoritesShortcode.php --- app/API/Shortcodes/UserFavoritesShortcode.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/API/Shortcodes/UserFavoritesShortcode.php b/app/API/Shortcodes/UserFavoritesShortcode.php index 0107ea6..150f1ee 100644 --- a/app/API/Shortcodes/UserFavoritesShortcode.php +++ b/app/API/Shortcodes/UserFavoritesShortcode.php @@ -97,3 +97,4 @@ public function renderView($options) ); } } +