Make WordPress Core

Ticket #37830: 37830.diff

File 37830.diff, 4.9 KB (added by wonderboymusic, 8 years ago)
  • src/wp-includes/class-wp-query.php

     
    1414 *
    1515 * @since 1.5.0
    1616 * @since 4.5.0 Removed the `$comments_popup` property.
     17 *
     18 * @method bool is_archive()      Is the query for an existing archive page? Month, Year, Category, Author, Post Type archive...
     19 * @method bool is_date()         Is the query for an existing date archive?
     20 * @method bool is_day()          Is the query for an existing day archive?
     21 * @method bool is_comment_feed() Is the query for a comments feed?
     22 * @method bool is_month()        Is the query for an existing month archive?
     23 * @method bool is_paged()        Is the query for paged result and not for the first page?
     24 * @method bool is_preview()      Is the query for a post or page preview?
     25 * @method bool is_robots()       Is the query for the robots file?
     26 * @method bool is_search()       Is the query for a search?
     27 * @method bool is_time()         Is the query for a specific time?
     28 * @method bool is_trackback()    Is the query for a trackback endpoint call?
     29 * @method bool is_year()         Is the query for an existing year archive?
     30 * @method bool is_404()          Is the query a 404 (returns no results)?
     31 * @method bool is_embed()        Is the query for an embedded post?
    1732 */
    1833class WP_Query {
    1934
     
    33813396                if ( in_array( $name, $this->compat_methods ) ) {
    33823397                        return call_user_func_array( array( $this, $name ), $arguments );
    33833398                }
     3399
     3400                if ( 'is_' === substr( $name, 0, 3 ) && property_exists( $this, $name ) ) {
     3401                        return (bool) $this->{$name};
     3402                }
     3403
    33843404                return false;
    33853405        }
    33863406
    33873407        /**
    3388          * Is the query for an existing archive page?
    3389          *
    3390          * Month, Year, Category, Author, Post Type archive...
    3391          *
    3392          * @since 3.1.0
    3393          *
    3394          * @return bool
    3395          */
    3396         public function is_archive() {
    3397                 return (bool) $this->is_archive;
    3398         }
    3399 
    3400         /**
    34013408         * Is the query for an existing post type archive page?
    34023409         *
    34033410         * @since 3.1.0
     
    36053612        }
    36063613
    36073614        /**
    3608          * Is the query for an existing date archive?
    3609          *
    3610          * @since 3.1.0
    3611          *
    3612          * @return bool
    3613          */
    3614         public function is_date() {
    3615                 return (bool) $this->is_date;
    3616         }
    3617 
    3618         /**
    3619          * Is the query for an existing day archive?
    3620          *
    3621          * @since 3.1.0
    3622          *
    3623          * @return bool
    3624          */
    3625         public function is_day() {
    3626                 return (bool) $this->is_day;
    3627         }
    3628 
    3629         /**
    36303615         * Is the query for a feed?
    36313616         *
    36323617         * @since 3.1.0
     
    36443629        }
    36453630
    36463631        /**
    3647          * Is the query for a comments feed?
    3648          *
    3649          * @since 3.1.0
    3650          *
    3651          * @return bool
    3652          */
    3653         public function is_comment_feed() {
    3654                 return (bool) $this->is_comment_feed;
    3655         }
    3656 
    3657         /**
    36583632         * Is the query for the front page of the site?
    36593633         *
    36603634         * This is for what is displayed at your site's main URL.
     
    37013675        }
    37023676
    37033677        /**
    3704          * Is the query for an existing month archive?
    3705          *
    3706          * @since 3.1.0
    3707          *
    3708          * @return bool
    3709          */
    3710         public function is_month() {
    3711                 return (bool) $this->is_month;
    3712         }
    3713 
    3714         /**
    37153678         * Is the query for an existing single page?
    37163679         *
    37173680         * If the $page parameter is specified, this function will additionally
     
    37593722        }
    37603723
    37613724        /**
    3762          * Is the query for paged result and not for the first page?
    3763          *
    3764          * @since 3.1.0
    3765          *
    3766          * @return bool
    3767          */
    3768         public function is_paged() {
    3769                 return (bool) $this->is_paged;
    3770         }
    3771 
    3772         /**
    3773          * Is the query for a post or page preview?
    3774          *
    3775          * @since 3.1.0
    3776          *
    3777          * @return bool
    3778          */
    3779         public function is_preview() {
    3780                 return (bool) $this->is_preview;
    3781         }
    3782 
    3783         /**
    3784          * Is the query for the robots file?
    3785          *
    3786          * @since 3.1.0
    3787          *
    3788          * @return bool
    3789          */
    3790         public function is_robots() {
    3791                 return (bool) $this->is_robots;
    3792         }
    3793 
    3794         /**
    3795          * Is the query for a search?
    3796          *
    3797          * @since 3.1.0
    3798          *
    3799          * @return bool
    3800          */
    3801         public function is_search() {
    3802                 return (bool) $this->is_search;
    3803         }
    3804 
    3805         /**
    38063725         * Is the query for an existing single post?
    38073726         *
    38083727         * Works for any post type, except attachments and pages
     
    38743793        }
    38753794
    38763795        /**
    3877          * Is the query for a specific time?
    3878          *
    3879          * @since 3.1.0
    3880          *
    3881          * @return bool
    3882          */
    3883         public function is_time() {
    3884                 return (bool) $this->is_time;
    3885         }
    3886 
    3887         /**
    3888          * Is the query for a trackback endpoint call?
    3889          *
    3890          * @since 3.1.0
    3891          *
    3892          * @return bool
    3893          */
    3894         public function is_trackback() {
    3895                 return (bool) $this->is_trackback;
    3896         }
    3897 
    3898         /**
    3899          * Is the query for an existing year archive?
    3900          *
    3901          * @since 3.1.0
    3902          *
    3903          * @return bool
    3904          */
    3905         public function is_year() {
    3906                 return (bool) $this->is_year;
    3907         }
    3908 
    3909         /**
    3910          * Is the query a 404 (returns no results)?
    3911          *
    3912          * @since 3.1.0
    3913          *
    3914          * @return bool
    3915          */
    3916         public function is_404() {
    3917                 return (bool) $this->is_404;
    3918         }
    3919 
    3920         /**
    3921          * Is the query for an embedded post?
    3922          *
    3923          * @since 4.4.0
    3924          *
    3925          * @return bool
    3926          */
    3927         public function is_embed() {
    3928                 return (bool) $this->is_embed;
    3929         }
    3930 
    3931         /**
    39323796         * Is the query the main query?
    39333797         *
    39343798         * @since 3.3.0