diff --git wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/extras.php wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/extras.php
index ef39383a..2a75618a 100755
|
|
add_filter( 'document_title_parts', 'wporg_developer_document_title' ); |
96 | 96 | * @return string |
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(); |
102 | 102 | $type = get_post_type_object( get_post_type( $post_id ) )->labels->singular_name; |
… |
… |
function wporg_loop_pagination( $page_links ) { |
194 | 194 | return $page_links; |
195 | 195 | } |
196 | 196 | add_filter( 'loop_pagination', 'wporg_loop_pagination' ); |
197 | | |
diff --git wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/handbooks.php wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/handbooks.php
index 1c2d355e..d20353ad 100644
|
|
class Devhub_Handbooks { |
62 | 62 | * @return array Array with public query vars. |
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; |
| 65 | $public_query_vars['current_handbook'] = ''; |
| 66 | $public_query_vars['current_handbook_home_url'] = ''; |
68 | 67 | $public_query_vars['current_handbook_name'] = ''; |
69 | 68 | |
70 | 69 | return $public_query_vars; |
… |
… |
class Devhub_Handbooks { |
77 | 76 | */ |
78 | 77 | public static function pre_get_posts( $query ) { |
79 | 78 | $is_handbook = function_exists( 'wporg_is_handbook' ) ? wporg_is_handbook() : false; |
80 | | $query->set( 'is_handbook', $is_handbook ); |
| 79 | $query->is_handbook = $is_handbook; |
81 | 80 | |
82 | | $current_handbook = function_exists( 'wporg_get_current_handbook' ) ? wporg_get_current_handbook() : false; |
| 81 | $current_handbook = function_exists( 'wporg_get_current_handbook' ) && wporg_get_current_handbook() ? wporg_get_current_handbook() : ''; |
83 | 82 | $query->set( 'current_handbook', $current_handbook ); |
84 | 83 | |
85 | | $current_handbook_home_url = function_exists( 'wporg_get_current_handbook_home_url' ) ? wporg_get_current_handbook_home_url() : false; |
| 84 | $current_handbook_home_url = function_exists( 'wporg_get_current_handbook_home_url' ) && wporg_get_current_handbook_home_url() ? wporg_get_current_handbook_home_url() : |
| 85 | ''; |
86 | 86 | $query->set( 'current_handbook_home_url', $current_handbook_home_url ); |
87 | 87 | |
88 | 88 | $current_handbook_name = function_exists( 'wporg_get_current_handbook_name' ) ? wporg_get_current_handbook_name() : ''; |
diff --git wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/redirects.php wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/redirects.php
index b81b1406..8758df13 100644
|
|
class DevHub_Redirects { |
32 | 32 | * Redirects a search query with only one result directly to that result. |
33 | 33 | */ |
34 | 34 | public static function redirect_single_search_match() { |
35 | | if ( is_search() && ! get_query_var( 'is_handbook' ) && 1 == $GLOBALS['wp_query']->found_posts ) { |
| 35 | if ( is_search() && ! $GLOBALS['wp_query']->is_handbook && 1 == $GLOBALS['wp_query']->found_posts ) { |
36 | 36 | wp_redirect( get_permalink( get_post() ) ); |
37 | 37 | exit(); |
38 | 38 | } |
diff --git wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/search.php wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/search.php
index 3fce6373..6dfff780 100644
|
|
class DevHub_Search { |
24 | 24 | add_action( 'pre_get_posts', array( __CLASS__, 'pre_get_posts' ), 20 ); |
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 for |
32 | | * a search. |
33 | | * |
34 | | * Defaults the query var 'empty_post_type_search' to false. It is potentially |
35 | | * set to true elsewhere. |
36 | | * |
37 | | * @param array $public_query_vars The array of whitelisted query variables. |
38 | | * @return array |
39 | | */ |
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 | |
45 | 29 | /** |
… |
… |
class DevHub_Search { |
59 | 43 | |
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. |
65 | 49 | $query->set( 'post_type', wporg_get_current_handbook() ); |
… |
… |
class DevHub_Search { |
82 | 66 | |
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. |
88 | 72 | // Fallback to parsed post types. |
diff --git wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php
index 7597ab55..b582475f 100755
|
|
namespace DevHub { |
1317 | 1317 | $post_types = get_parsed_post_types(); |
1318 | 1318 | $taxonomies = array( 'wp-parser-since', 'wp-parser-package', 'wp-parser-source-file' ); |
1319 | 1319 | |
1320 | | return ! ( is_search() || is_404() ) && ( is_singular( $post_types ) || is_post_type_archive( $post_types ) || is_tax( $taxonomies ) || get_query_var( 'is_handbook' ) ); |
| 1320 | return ! ( is_search() || is_404() ) && ( is_singular( $post_types ) || is_post_type_archive( $post_types ) || is_tax( $taxonomies ) || $GLOBALS['wp_query']->is_handbook ); |
1321 | 1321 | } |
1322 | 1322 | |
1323 | 1323 | /** |
diff --git wordpress.org/public_html/wp-content/themes/pub/wporg-developer/search.php wordpress.org/public_html/wp-content/themes/pub/wporg-developer/search.php
index 0561c23c..24197b49 100755
|
|
get_header(); ?> |
13 | 13 | <span class="trail-browse"><span class="trail-begin"><?php _e( 'Search Results', 'wporg' ); ?></span></span><span class="sep">:</span> |
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' ) ) : ?> |
19 | 19 | <span><a href="<?php echo esc_url( get_permalink( $reference_page ) ); ?>"><?php echo get_the_title( $reference_page ); ?></a></span> |
… |
… |
get_header(); ?> |
31 | 31 | <?php /* Start the Loop */ ?> |
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; ?> |
37 | 37 | |
diff --git wordpress.org/public_html/wp-content/themes/pub/wporg-developer/searchform.php wordpress.org/public_html/wp-content/themes/pub/wporg-developer/searchform.php
index 2f3ac5ec..32f9b009 100755
|
|
|
34 | 34 | <?php } ?> |
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( '/' ); |
40 | 40 | $filters = ! ( $is_handbook || is_404() ); |
… |
… |
|
61 | 61 | ); |
62 | 62 | |
63 | 63 | $qv_post_type = array_filter( (array) get_query_var( 'post_type' ) ); |
64 | | $no_filters = get_query_var( 'empty_post_type_search' ); |
| 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 ) { |
67 | 67 | // No filters used. |