Changeset 7319
- Timestamp:
- 06/19/2018 09:44:33 AM (7 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/extras.php
r5598 r7319 97 97 */ 98 98 function wporg_filter_archive_excerpt( $excerpt ) { 99 if ( ! is_single() && ! get_query_var( 'is_handbook' )&& 'command' !== get_query_var( 'post_type' ) ) {99 if ( ! is_single() && ! $GLOBALS['wp_query']->is_handbook && 'command' !== get_query_var( 'post_type' ) ) { 100 100 101 101 $post_id = get_the_ID(); … … 201 201 } 202 202 add_filter( 'loop_pagination', 'wporg_loop_pagination' ); 203 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/handbooks.php
r5681 r7319 63 63 */ 64 64 public static function add_query_vars( $public_query_vars ) { 65 $public_query_vars['is_handbook'] = false; 66 $public_query_vars['current_handbook'] = false; 67 $public_query_vars['current_handbook_home_url'] = false; 68 $public_query_vars['current_handbook_name'] = ''; 65 $public_query_vars[] = 'current_handbook'; 66 $public_query_vars[] = 'current_handbook_home_url'; 67 $public_query_vars[] = 'current_handbook_name'; 69 68 70 69 return $public_query_vars; … … 77 76 */ 78 77 public static function pre_get_posts( $query ) { 79 $is_handbook = function_exists( 'wporg_is_handbook' ) ? wporg_is_handbook() : false; 80 $query->set( 'is_handbook', $is_handbook ); 81 82 $current_handbook = function_exists( 'wporg_get_current_handbook' ) ? wporg_get_current_handbook() : false; 78 $query->is_handbook = function_exists( 'wporg_is_handbook' ) && wporg_is_handbook(); 79 80 $current_handbook = function_exists( 'wporg_get_current_handbook' ) ? (string) wporg_get_current_handbook() : ''; 83 81 $query->set( 'current_handbook', $current_handbook ); 84 82 85 $current_handbook_home_url = function_exists( 'wporg_get_current_handbook_home_url' ) ? wporg_get_current_handbook_home_url() : false;83 $current_handbook_home_url = function_exists( 'wporg_get_current_handbook_home_url' ) ? (string) wporg_get_current_handbook_home_url() : ''; 86 84 $query->set( 'current_handbook_home_url', $current_handbook_home_url ); 87 85 88 $current_handbook_name = function_exists( 'wporg_get_current_handbook_name' ) ? wporg_get_current_handbook_name() : '';86 $current_handbook_name = function_exists( 'wporg_get_current_handbook_name' ) ? (string) wporg_get_current_handbook_name() : ''; 89 87 $query->set( 'current_handbook_name', $current_handbook_name ); 90 88 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/redirects.php
r4709 r7319 31 31 /** 32 32 * Redirects a search query with only one result directly to that result. 33 * 34 * @globals \WP_Query $wp_query Global WP_Query instance. 33 35 */ 34 36 public static function redirect_single_search_match() { 35 if ( is_search() && ! get_query_var( 'is_handbook' ) && 1 == $GLOBALS['wp_query']->found_posts ) { 37 global $wp_query; 38 39 if ( is_search() && ! $wp_query->is_handbook && 1 == $wp_query->found_posts ) { 36 40 wp_redirect( get_permalink( get_post() ) ); 37 41 exit(); -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/search.php
r5432 r7319 25 25 add_filter( 'posts_orderby', array( __CLASS__, 'search_posts_orderby' ), 10, 2 ); 26 26 add_filter( 'the_posts', array( __CLASS__, 'rerun_empty_exact_search' ), 10, 2 ); 27 add_filter( 'query_vars', array( __CLASS__, 'default_qv_empty_post_type_search' ) );28 }29 30 /**31 * Add query var to indicate if no post type filters were explicitly used for32 * a search.33 *34 * Defaults the query var 'empty_post_type_search' to false. It is potentially35 * set to true elsewhere.36 *37 * @param array $public_query_vars The array of whitelisted query variables.38 * @return array39 */40 public static function default_qv_empty_post_type_search( $public_query_vars ) {41 $public_query_vars['empty_post_type_search'] = false;42 return $public_query_vars;43 27 } 44 28 … … 60 44 // Separates searches for handbook pages from non-handbook pages depending on 61 45 // whether the search was performed within context of a handbook page or not. 62 if ( get_query_var( 'is_handbook' )) {46 if ( $query->is_handbook ) { 63 47 // Search only in current handbook post type. 64 48 // Just to make sure. post type should already be set. … … 83 67 if ( ! $qv_post_types ) { 84 68 // Record the fact no post types were explicitly supplied. 85 $query-> set( 'empty_post_type_search', true );69 $query->is_empty_post_type_search = true; 86 70 87 71 // Not a handbook page, or exact search, or filters used. -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/search.php
r3380 r7319 14 14 <span><a href="<?php echo home_url( '/' ); ?>"><?php _e( 'Home', 'wporg' ); ?></a></span> 15 15 <span class="sep">/</span> 16 <?php if ( get_query_var( 'is_handbook' )) : ?>16 <?php if ( $GLOBALS['wp_query']->is_handbook ) : ?> 17 17 <span><a href="<?php echo esc_url( get_query_var( 'current_handbook_home_url' ) ); ?>"><?php echo get_query_var( 'current_handbook_name' ); ?></a></span> 18 18 <?php elseif ( $reference_page = get_page_by_path( 'reference' ) ) : ?> … … 32 32 <?php while ( have_posts() ) : the_post(); ?> 33 33 34 <?php get_template_part( 'content', get_query_var( 'is_handbook' )? 'handbook-archive' : 'reference-archive' ); ?>34 <?php get_template_part( 'content', $GLOBALS['wp_query']->is_handbook ? 'handbook-archive' : 'reference-archive' ); ?> 35 35 36 36 <?php endwhile; ?> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/searchform.php
r4551 r7319 35 35 36 36 <?php 37 $is_handbook = get_query_var( 'is_handbook' );37 $is_handbook = $GLOBALS['wp_query']->is_handbook; 38 38 $search_url = get_query_var( 'current_handbook_home_url' ); 39 39 $search_url = $search_url ? $search_url : home_url( '/' ); … … 60 60 'wp-parser-method' => __( 'Methods', 'wporg' ), 61 61 ); 62 63 $qv_post_type = array_filter( (array) get_query_var( 'post_type' ) ); 64 $no_filters = get_query_var( 'empty_post_type_search' );62 63 $qv_post_type = array_filter( (array) get_query_var( 'post_type' ) ); 64 $no_filters = $GLOBALS['wp_query']->is_empty_post_type_search; 65 65 66 66 if ( ! is_search() || in_array( 'any', $qv_post_type ) || $no_filters ) { … … 68 68 $qv_post_type = array(); 69 69 } 70 70 71 71 foreach ( $search_post_types as $post_type => $label ) { 72 72 $checked = checked( in_array( $post_type, $qv_post_type ), true, false );
Note: See TracChangeset
for help on using the changeset viewer.