| @@ 144-160 (lines=17) @@ | ||
| 141 | $query['post__not_in'] = array_merge( $query['post__not_in'], (array) $args['exclude'] ); |
|
| 142 | } |
|
| 143 | ||
| 144 | if ( isset( $args['exclude_tree'] ) && is_post_type_hierarchical( $args['type'] ) ) { |
|
| 145 | // get_page_children is a misnomer; it supports all hierarchical post types |
|
| 146 | $page_args = array( |
|
| 147 | 'child_of' => $args['exclude_tree'], |
|
| 148 | 'post_type' => $args['type'], |
|
| 149 | // since we're looking for things to exclude, be aggressive |
|
| 150 | 'post_status' => 'publish,draft,pending,private,future,trash', |
|
| 151 | ); |
|
| 152 | $post_descendants = get_pages( $page_args ); |
|
| 153 | ||
| 154 | $exclude_tree = array( $args['exclude_tree'] ); |
|
| 155 | foreach ( $post_descendants as $child ) { |
|
| 156 | $exclude_tree[] = $child->ID; |
|
| 157 | } |
|
| 158 | ||
| 159 | $query['post__not_in'] = isset( $query['post__not_in'] ) ? array_merge( $query['post__not_in'], $exclude_tree ) : $exclude_tree; |
|
| 160 | } |
|
| 161 | ||
| 162 | if ( isset( $args['category'] ) ) { |
|
| 163 | $category = get_term_by( 'slug', $args['category'], 'category' ); |
|
| @@ 156-172 (lines=17) @@ | ||
| 153 | $query['post__not_in'] = isset( $query['post__not_in'] ) ? array_merge( $query['post__not_in'], $excluded_ids ) : $excluded_ids; |
|
| 154 | } |
|
| 155 | ||
| 156 | if ( isset( $args['exclude_tree'] ) && is_post_type_hierarchical( $args['type'] ) ) { |
|
| 157 | // get_page_children is a misnomer; it supports all hierarchical post types |
|
| 158 | $page_args = array( |
|
| 159 | 'child_of' => $args['exclude_tree'], |
|
| 160 | 'post_type' => $args['type'], |
|
| 161 | // since we're looking for things to exclude, be aggressive |
|
| 162 | 'post_status' => 'publish,draft,pending,private,future,trash', |
|
| 163 | ); |
|
| 164 | $post_descendants = get_pages( $page_args ); |
|
| 165 | ||
| 166 | $exclude_tree = array( $args['exclude_tree'] ); |
|
| 167 | foreach ( $post_descendants as $child ) { |
|
| 168 | $exclude_tree[] = $child->ID; |
|
| 169 | } |
|
| 170 | ||
| 171 | $query['post__not_in'] = isset( $query['post__not_in'] ) ? array_merge( $query['post__not_in'], $exclude_tree ) : $exclude_tree; |
|
| 172 | } |
|
| 173 | ||
| 174 | if ( isset( $args['category'] ) ) { |
|
| 175 | $category = get_term_by( 'slug', $args['category'], 'category' ); |
|
| @@ 154-170 (lines=17) @@ | ||
| 151 | $query['post__not_in'] = isset( $query['post__not_in'] ) ? array_merge( $query['post__not_in'], $excluded_ids ) : $excluded_ids; |
|
| 152 | } |
|
| 153 | ||
| 154 | if ( isset( $args['exclude_tree'] ) && is_post_type_hierarchical( $args['type'] ) ) { |
|
| 155 | // get_page_children is a misnomer; it supports all hierarchical post types |
|
| 156 | $page_args = array( |
|
| 157 | 'child_of' => $args['exclude_tree'], |
|
| 158 | 'post_type' => $args['type'], |
|
| 159 | // since we're looking for things to exclude, be aggressive |
|
| 160 | 'post_status' => 'publish,draft,pending,private,future,trash', |
|
| 161 | ); |
|
| 162 | $post_descendants = get_pages( $page_args ); |
|
| 163 | ||
| 164 | $exclude_tree = array( $args['exclude_tree'] ); |
|
| 165 | foreach ( $post_descendants as $child ) { |
|
| 166 | $exclude_tree[] = $child->ID; |
|
| 167 | } |
|
| 168 | ||
| 169 | $query['post__not_in'] = isset( $query['post__not_in'] ) ? array_merge( $query['post__not_in'], $exclude_tree ) : $exclude_tree; |
|
| 170 | } |
|
| 171 | ||
| 172 | if ( isset( $args['category'] ) ) { |
|
| 173 | $category = get_term_by( 'slug', $args['category'], 'category' ); |
|