Ticket #20509: 20509.patch
| File 20509.patch, 3.5 KB (added by johnbillion, 13 months ago) |
|---|
-
wp-includes/plugin.php
595 595 return trailingslashit( plugins_url( '', $file ) ); 596 596 } 597 597 598 function register_generic_plugin_template( $file ) { 599 global $wp_generic_plugin_template; 600 $wp_generic_plugin_template = $file; 601 } 602 603 function get_generic_plugin_template() { 604 global $wp_generic_plugin_template; 605 return $wp_generic_plugin_template ? $wp_generic_plugin_template : false; 606 } 607 598 608 /** 599 609 * Set the activation hook for a plugin. 600 610 * -
wp-includes/query.php
715 715 } 716 716 717 717 /** 718 * Is the query a generic request? 719 * 720 * @see WP_Query::is_generic_request() 721 * @since 3.4 722 * @uses $wp_query 723 * 724 * @return bool 725 */ 726 function is_generic_request() { 727 global $wp_query; 728 729 if ( ! isset( $wp_query ) ) { 730 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); 731 return false; 732 } 733 734 return $wp_query->is_generic_request(); 735 } 736 737 /** 718 738 * Is the query the main query? 719 739 * 720 740 * @since 3.3.0 … … 1177 1197 var $is_404 = false; 1178 1198 1179 1199 /** 1200 * Set if query is a generic request. 1201 * 1202 * @since 3.4 1203 * @access public 1204 * @var bool 1205 */ 1206 var $is_generic_request = false; 1207 1208 /** 1180 1209 * Set if query is within comments popup window. 1181 1210 * 1182 1211 * @since 1.5.0 … … 1305 1334 $this->is_trackback = false; 1306 1335 $this->is_home = false; 1307 1336 $this->is_404 = false; 1337 $this->is_generic_request = false; 1308 1338 $this->is_comments_popup = false; 1309 1339 $this->is_paged = false; 1310 1340 $this->is_admin = false; … … 3501 3531 } 3502 3532 3503 3533 /** 3534 * Is the query a generic request? 3535 * 3536 * @since 3.4 3537 * 3538 * @return bool 3539 */ 3540 function is_generic_request() { 3541 return (bool) $this->is_generic_request; 3542 } 3543 3544 /** 3504 3545 * Is the query the main query? 3505 3546 * 3506 3547 * @since 3.3.0 -
wp-includes/template-loader.php
20 20 21 21 if ( defined('WP_USE_THEMES') && WP_USE_THEMES ) : 22 22 $template = false; 23 if ( is_404() && $template = get_404_template() ) : 23 if ( is_generic_request() && $template = get_generic_request_template() ) : 24 elseif ( is_404() && $template = get_404_template() ) : 24 25 elseif ( is_search() && $template = get_search_template() ) : 25 26 elseif ( is_tax() && $template = get_taxonomy_template() ) : 26 27 elseif ( is_front_page() && $template = get_front_page_template() ) : -
wp-includes/template.php
52 52 } 53 53 54 54 /** 55 * Retrieve path of generic request template in current or parent template. 56 * 57 * @since 3.4 58 * 59 * @return string 60 */ 61 function get_generic_request_template() { 62 $generic = get_query_template('generic'); 63 64 if ( !$generic ) 65 $generic = get_generic_plugin_template(); 66 67 if ( !$generic ) 68 $generic = get_index_template(); 69 70 return $generic; 71 } 72 73 /** 55 74 * Retrieve path of archive template in current or parent template. 56 75 * 57 76 * @since 1.5.0
