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