mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
git-svn-id: http://svn.automattic.com/wordpress/trunk@16947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a5ae036374
commit
d151bf4d8a
@ -142,6 +142,11 @@ function wp_reset_postdata() {
|
|||||||
function is_archive() {
|
function is_archive() {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_archive();
|
return $wp_query->is_archive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,6 +163,11 @@ function is_archive() {
|
|||||||
function is_post_type_archive( $post_types = '' ) {
|
function is_post_type_archive( $post_types = '' ) {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_post_type_archive( $post_types );
|
return $wp_query->is_post_type_archive( $post_types );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,6 +183,11 @@ function is_post_type_archive( $post_types = '' ) {
|
|||||||
function is_attachment() {
|
function is_attachment() {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_attachment();
|
return $wp_query->is_attachment();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,6 +207,11 @@ function is_attachment() {
|
|||||||
function is_author( $author = '' ) {
|
function is_author( $author = '' ) {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_author( $author );
|
return $wp_query->is_author( $author );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,6 +231,11 @@ function is_author( $author = '' ) {
|
|||||||
function is_category( $category = '' ) {
|
function is_category( $category = '' ) {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_category( $category );
|
return $wp_query->is_category( $category );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,6 +255,11 @@ function is_category( $category = '' ) {
|
|||||||
function is_tag( $slug = '' ) {
|
function is_tag( $slug = '' ) {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_tag( $slug );
|
return $wp_query->is_tag( $slug );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,7 +282,12 @@ function is_tag( $slug = '' ) {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function is_tax( $taxonomy = '', $term = '' ) {
|
function is_tax( $taxonomy = '', $term = '' ) {
|
||||||
global $wp_query, $wp_taxonomies;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_tax( $taxonomy, $term );
|
return $wp_query->is_tax( $taxonomy, $term );
|
||||||
}
|
}
|
||||||
@ -269,6 +304,11 @@ function is_tax( $taxonomy = '', $term = '' ) {
|
|||||||
function is_comments_popup() {
|
function is_comments_popup() {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_comments_popup();
|
return $wp_query->is_comments_popup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,6 +324,11 @@ function is_comments_popup() {
|
|||||||
function is_date() {
|
function is_date() {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_date();
|
return $wp_query->is_date();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,6 +344,11 @@ function is_date() {
|
|||||||
function is_day() {
|
function is_day() {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_day();
|
return $wp_query->is_day();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,6 +365,11 @@ function is_day() {
|
|||||||
function is_feed( $feeds = '' ) {
|
function is_feed( $feeds = '' ) {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_feed( $feeds );
|
return $wp_query->is_feed( $feeds );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,6 +385,11 @@ function is_feed( $feeds = '' ) {
|
|||||||
function is_comment_feed() {
|
function is_comment_feed() {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_comment_feed();
|
return $wp_query->is_comment_feed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,6 +415,11 @@ function is_comment_feed() {
|
|||||||
function is_front_page() {
|
function is_front_page() {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_front_page();
|
return $wp_query->is_front_page();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,6 +444,11 @@ function is_front_page() {
|
|||||||
function is_home() {
|
function is_home() {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_home();
|
return $wp_query->is_home();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,6 +464,11 @@ function is_home() {
|
|||||||
function is_month() {
|
function is_month() {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_month();
|
return $wp_query->is_month();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,6 +491,11 @@ function is_month() {
|
|||||||
function is_page( $page = '' ) {
|
function is_page( $page = '' ) {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_page( $page );
|
return $wp_query->is_page( $page );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,6 +511,11 @@ function is_page( $page = '' ) {
|
|||||||
function is_paged() {
|
function is_paged() {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_paged();
|
return $wp_query->is_paged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,6 +531,11 @@ function is_paged() {
|
|||||||
function is_preview() {
|
function is_preview() {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_preview();
|
return $wp_query->is_preview();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,6 +551,11 @@ function is_preview() {
|
|||||||
function is_robots() {
|
function is_robots() {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_robots();
|
return $wp_query->is_robots();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -476,6 +571,11 @@ function is_robots() {
|
|||||||
function is_search() {
|
function is_search() {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_search();
|
return $wp_query->is_search();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,6 +600,11 @@ function is_search() {
|
|||||||
function is_single( $post = '' ) {
|
function is_single( $post = '' ) {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_single( $post );
|
return $wp_query->is_single( $post );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -522,6 +627,11 @@ function is_single( $post = '' ) {
|
|||||||
function is_singular( $post_types = '' ) {
|
function is_singular( $post_types = '' ) {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_singular( $post_types );
|
return $wp_query->is_singular( $post_types );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,6 +647,11 @@ function is_singular( $post_types = '' ) {
|
|||||||
function is_time() {
|
function is_time() {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_time();
|
return $wp_query->is_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -552,6 +667,11 @@ function is_time() {
|
|||||||
function is_trackback() {
|
function is_trackback() {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_trackback();
|
return $wp_query->is_trackback();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -567,6 +687,11 @@ function is_trackback() {
|
|||||||
function is_year() {
|
function is_year() {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_year();
|
return $wp_query->is_year();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,6 +707,11 @@ function is_year() {
|
|||||||
function is_404() {
|
function is_404() {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_query ) ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' );
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_query->is_404();
|
return $wp_query->is_404();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user