From 1e9676d22c9792f4b8ecb4a71015201bbda4dfda Mon Sep 17 00:00:00 2001 From: Matthew Schroeter Date: Wed, 4 May 2022 14:47:43 -0500 Subject: [PATCH] v0.1.7 --- classes/Base/Group.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/classes/Base/Group.php b/classes/Base/Group.php index 2dffdaf..53ebbd1 100644 --- a/classes/Base/Group.php +++ b/classes/Base/Group.php @@ -42,6 +42,13 @@ class Group { */ protected $post_types; + /** + * Page Types on which to display group + * + * @var $page_types array + */ + protected $page_types; + /** * Templates on which to display group * @@ -191,6 +198,16 @@ public function setPostTypes( $post_types = [] ) { $this->post_types = $post_types; } + /** + * Set the post types on which to show the group + * + * @param array $post_types + * @since 0.1.0 + */ + public function setPageTypes( $page_types = [] ) { + $this->page_types = $page_types; + } + /** * Set the post types on which to ignore the group * @@ -317,6 +334,18 @@ public function getLocations() { } } + if( ! empty( $this->page_types ) ) { + foreach( $this->page_types as $page_type) { + $toAdd = + [ + 'param' => 'page_type', + 'operator' => '==', + 'value' => $page_type, + ]; + array_push($results, $toAdd); + } + } + return [$results]; }