| @@ 203-219 (lines=17) @@ | ||
| 200 | $query['post__not_in'] = array_merge( $query['post__not_in'], (array) $args['exclude'] ); |
|
| 201 | } |
|
| 202 | ||
| 203 | if ( isset( $args['exclude_tree'] ) && is_post_type_hierarchical( $args['type'] ) ) { |
|
| 204 | // get_page_children is a misnomer; it supports all hierarchical post types |
|
| 205 | $page_args = array( |
|
| 206 | 'child_of' => $args['exclude_tree'], |
|
| 207 | 'post_type' => $args['type'], |
|
| 208 | // since we're looking for things to exclude, be aggressive |
|
| 209 | 'post_status' => 'publish,draft,pending,private,future,trash', |
|
| 210 | ); |
|
| 211 | $post_descendants = get_pages( $page_args ); |
|
| 212 | ||
| 213 | $exclude_tree = array( $args['exclude_tree'] ); |
|
| 214 | foreach ( $post_descendants as $child ) { |
|
| 215 | $exclude_tree[] = $child->ID; |
|
| 216 | } |
|
| 217 | ||
| 218 | $query['post__not_in'] = isset( $query['post__not_in'] ) ? array_merge( $query['post__not_in'], $exclude_tree ) : $exclude_tree; |
|
| 219 | } |
|
| 220 | ||
| 221 | if ( isset( $args['category'] ) ) { |
|
| 222 | $category = get_term_by( 'slug', $args['category'], 'category' ); |
|
| @@ 228-244 (lines=17) @@ | ||
| 225 | $query['post__not_in'] = isset( $query['post__not_in'] ) ? array_merge( $query['post__not_in'], $excluded_ids ) : $excluded_ids; |
|
| 226 | } |
|
| 227 | ||
| 228 | if ( isset( $args['exclude_tree'] ) && is_post_type_hierarchical( $args['type'] ) ) { |
|
| 229 | // get_page_children is a misnomer; it supports all hierarchical post types |
|
| 230 | $page_args = array( |
|
| 231 | 'child_of' => $args['exclude_tree'], |
|
| 232 | 'post_type' => $args['type'], |
|
| 233 | // since we're looking for things to exclude, be aggressive |
|
| 234 | 'post_status' => 'publish,draft,pending,private,future,trash', |
|
| 235 | ); |
|
| 236 | $post_descendants = get_pages( $page_args ); |
|
| 237 | ||
| 238 | $exclude_tree = array( $args['exclude_tree'] ); |
|
| 239 | foreach ( $post_descendants as $child ) { |
|
| 240 | $exclude_tree[] = $child->ID; |
|
| 241 | } |
|
| 242 | ||
| 243 | $query['post__not_in'] = isset( $query['post__not_in'] ) ? array_merge( $query['post__not_in'], $exclude_tree ) : $exclude_tree; |
|
| 244 | } |
|
| 245 | ||
| 246 | if ( isset( $args['category'] ) ) { |
|
| 247 | $category = get_term_by( 'slug', $args['category'], 'category' ); |
|
| @@ 222-238 (lines=17) @@ | ||
| 219 | $query['post__not_in'] = isset( $query['post__not_in'] ) ? array_merge( $query['post__not_in'], $excluded_ids ) : $excluded_ids; |
|
| 220 | } |
|
| 221 | ||
| 222 | if ( isset( $args['exclude_tree'] ) && is_post_type_hierarchical( $args['type'] ) ) { |
|
| 223 | // get_page_children is a misnomer; it supports all hierarchical post types |
|
| 224 | $page_args = array( |
|
| 225 | 'child_of' => $args['exclude_tree'], |
|
| 226 | 'post_type' => $args['type'], |
|
| 227 | // since we're looking for things to exclude, be aggressive |
|
| 228 | 'post_status' => 'publish,draft,pending,private,future,trash', |
|
| 229 | ); |
|
| 230 | $post_descendants = get_pages( $page_args ); |
|
| 231 | ||
| 232 | $exclude_tree = array( $args['exclude_tree'] ); |
|
| 233 | foreach ( $post_descendants as $child ) { |
|
| 234 | $exclude_tree[] = $child->ID; |
|
| 235 | } |
|
| 236 | ||
| 237 | $query['post__not_in'] = isset( $query['post__not_in'] ) ? array_merge( $query['post__not_in'], $exclude_tree ) : $exclude_tree; |
|
| 238 | } |
|
| 239 | ||
| 240 | if ( isset( $args['category'] ) ) { |
|
| 241 | $category = get_term_by( 'slug', $args['category'], 'category' ); |
|