taxonomy + get-all-children
-
Dear Dani,
thanks for the great plugin; I appreciate your work!
Issue:
all-children=yes not working properly for taxonomy and post type pages in Ver. 4.3.0How to reproduce:
I have the following setup: I want to list a set of pages via the a-z-listing shortcode; pages are assigned to individual categories C1..C3. These categories are children of a parent category P.– Parent category P
– Child category C1
– Child category C2
– Child category C3What I would like to make use of is just to specify the parent category P and add all-children=yes, to get all pages belonging to any of the child categories, because in future the number of children categories might change. However, it does not list pages associated to appropriate child categories.
[a-z-listing display="posts" post-type="page" taxonomy="category" terms="M" get-all-children="yes"]
What works perfect is to specify any of the children categories in the terms parameter list:
[a-z-listing display="posts" post-type="page" taxonomy="category" terms="C1,C2,C3"]
Quick fix:
--- src/Shortcode/QueryParts/PostsTerms.php.org 2022-07-06 11:57:38.415622435 +0200 +++ src/Shortcode/QueryParts/PostsTerms.php 2022-07-06 11:58:17.542679681 +0200 @@ -53,7 +53,7 @@ 'field' => 'term_id', 'terms' => $include_terms, 'operator' => 'IN', - 'include_children' => false, + 'include_children' => (isset( $attributes['get-all-children'] ) && a_z_listing_is_truthy( $attributes['get-all-children'] )), ); } if ( ! empty( $exclude_terms ) ) { @@ -62,7 +62,7 @@ 'field' => 'term_id', 'terms' => $exclude_terms, 'operator' => 'NOT IN', - 'include_children' => false, + 'include_children' => (isset( $attributes['get-all-children'] ) && a_z_listing_is_truthy( $attributes['get-all-children'] )), ); }
- The topic ‘taxonomy + get-all-children’ is closed to new replies.