Changeset 3698 for sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/template-tags.php
- Timestamp:
- 07/20/2016 04:41:16 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/template-tags.php
r3263 r3698 27 27 * Is the query for an existing handbook page? 28 28 * 29 * @param string $handbook Handbook post type.30 * @return bool 29 * @param string|array $handbook Handbook post type(s). 30 * @return bool Whether the query is for an existing handbook page. Returns true on handbook pages. 31 31 */ 32 32 function wporg_is_handbook( $handbook = '' ) { 33 33 $post_types = wporg_get_handbook_post_types(); 34 if ( ! is_array( $handbook ) ) { 35 $handbook = $handbook ? (array) $handbook : array(); 36 } 34 37 35 38 if ( is_admin() || ! $post_types ) { … … 38 41 39 42 foreach ( $post_types as $post_type ) { 40 $is_handbook = ! $handbook || ( $handbook === $post_type ); 41 $single_handbook = false; 43 // Skip unless checking for all handbooks or for the specified handbook(s). 44 if ( $handbook && ! in_array( $post_type, $handbook ) ) { 45 continue; 46 } 42 47 43 if ( is_singular() ) { 48 $handbook_query = is_post_type_archive( $post_type ) || get_query_var( 'is_handbook_root' ); 49 50 if ( ! $handbook_query && is_singular() ) { 44 51 $queried_obj = get_queried_object(); 45 52 46 53 if ( $queried_obj ) { 47 $ single_handbook= is_singular( $post_type );54 $handbook_query = is_singular( $post_type ); 48 55 } else { 49 // Queried object is not set, use the post type query var. 56 // Queried object is not set, use the post type query var. 50 57 $qv_post_type = get_query_var( 'post_type' ); 51 58 … … 54 61 } 55 62 56 $ single_handbook= ( $post_type === $qv_post_type );63 $handbook_query = ( $post_type === $qv_post_type ); 57 64 } 58 65 } 59 66 60 $handbook_query = $single_handbook || is_post_type_archive( $post_type ); 61 62 if ( $is_handbook && $handbook_query ) { 67 if ( $handbook_query ) { 63 68 return true; 64 69 }
Note: See TracChangeset
for help on using the changeset viewer.