Changeset 3281
- Timestamp:
- 05/31/2016 08:10:44 PM (10 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
- Files:
-
- 6 edited
-
inc/extras.php (modified) (1 diff)
-
inc/handbooks.php (modified) (2 diffs)
-
inc/redirects.php (modified) (1 diff)
-
inc/search.php (modified) (1 diff)
-
inc/user-content.php (modified) (1 diff)
-
searchform.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/extras.php
r3279 r3281 97 97 */ 98 98 function wporg_filter_archive_excerpt( $excerpt ) { 99 if ( ! is_single() && ! wporg_is_handbook() ) {99 if ( ! is_single() && ! get_query_var( 'is_handbook' ) ) { 100 100 101 101 $post_id = get_the_ID(); -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/handbooks.php
r3239 r3281 35 35 */ 36 36 public static function do_init() { 37 add_filter( 'query_vars', array( __CLASS__, 'add_query_vars' ) ); 38 39 add_action( 'pre_get_posts', array( __CLASS__, 'pre_get_posts' ), 9 ); 40 37 41 add_action( 'after_switch_theme', array( __CLASS__, 'add_roles' ) ); 38 42 … … 52 56 add_filter( 'syntaxhighlighter_htmlresult', array( __CLASS__, 'syntaxhighlighter_htmlresult' ) ); 53 57 } 58 } 59 60 /** 61 * Add public query vars for handbooks. 62 * 63 * @param array $public_query_vars The array of whitelisted query variables. 64 * @return array Array with public query vars. 65 */ 66 public static function add_query_vars( $public_query_vars ) { 67 $public_query_vars['is_handbook'] = false; 68 $public_query_vars['current_handbook'] = false; 69 $public_query_vars['current_handbook_home_url'] = false; 70 $public_query_vars['current_handbook_name'] = ''; 71 72 return $public_query_vars; 73 } 74 75 /** 76 * Add handbook query vars to the current query. 77 * 78 * @param \WP_Query $query 79 */ 80 public static function pre_get_posts( $query ) { 81 $is_handbook = function_exists( 'wporg_is_handbook' ) ? wporg_is_handbook() : false; 82 $query->set( 'is_handbook', $is_handbook ); 83 84 $current_handbook = function_exists( 'wporg_get_current_handbook' ) ? wporg_get_current_handbook() : false; 85 $query->set( 'current_handbook', $current_handbook ); 86 87 $current_handbook_home_url = function_exists( 'wporg_get_current_handbook_home_url' ) ? wporg_get_current_handbook_home_url() : false; 88 $query->set( 'current_handbook_home_url', $current_handbook_home_url ); 89 90 $current_handbook_name = function_exists( 'wporg_get_current_handbook_name' ) ? wporg_get_current_handbook_name() : ''; 91 $query->set( 'current_handbook_name', $current_handbook_name ); 54 92 } 55 93 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/redirects.php
r3242 r3281 33 33 */ 34 34 public static function redirect_single_search_match() { 35 if ( is_search() && ! wporg_is_handbook() && 1 == $GLOBALS['wp_query']->found_posts ) {35 if ( is_search() && ! get_query_var( 'is_handbook' ) && 1 == $GLOBALS['wp_query']->found_posts ) { 36 36 wp_redirect( get_permalink( get_post() ) ); 37 37 exit(); -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/search.php
r3278 r3281 60 60 // Separates searches for handbook pages from non-handbook pages depending on 61 61 // whether the search was performed within context of a handbook page or not. 62 if ( wporg_is_handbook() ) {62 if ( get_query_var( 'is_handbook' ) ) { 63 63 // Search only in current handbook post type. 64 64 // Just to make sure. post type should already be set. -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content.php
r3239 r3281 63 63 public static function scripts_and_styles() { 64 64 if ( is_singular() ) { 65 if ( '0' != get_comments_number() || \DevHub\post_type_has_source_code() || wporg_is_handbook_post_type() ) {65 if ( '0' != get_comments_number() || \DevHub\post_type_has_source_code() || get_query_var( 'is_handbook' ) ) { 66 66 wp_enqueue_script( 'wporg-developer-function-reference', get_template_directory_uri() . '/js/function-reference.js', array( 'jquery', 'syntaxhighlighter-core', 'syntaxhighlighter-brush-php' ), '20150319', true ); 67 67 wp_enqueue_style( 'syntaxhighlighter-core' ); -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/searchform.php
r3278 r3281 35 35 36 36 <?php 37 $is_handbook = wporg_is_handbook(); 38 $search_url = $is_handbook ? wporg_get_current_handbook_home_url() : home_url( '/' ); 37 $is_handbook = get_query_var( 'is_handbook' ); 38 $search_url = get_query_var( 'current_handbook_home_url' ); 39 $search_url = $search_url ? $search_url : home_url( '/' ); 39 40 $form_class = $is_handbook ? ' searchform-handbook' : ''; 40 41 ?>
Note: See TracChangeset
for help on using the changeset viewer.