Allow is_feed() to drill down the feed being checked. props johnbillion for initial patch, fixes #15460.

git-svn-id: http://svn.automattic.com/wordpress/trunk@16447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-11-18 03:19:08 +00:00
parent 8ff32f52df
commit 695644cc72

View File

@ -309,12 +309,13 @@ function is_day() {
* @since 1.5.0 * @since 1.5.0
* @uses $wp_query * @uses $wp_query
* *
* @param string|array $feeds Optional feed types to check.
* @return bool * @return bool
*/ */
function is_feed() { function is_feed( $feeds = '' ) {
global $wp_query; global $wp_query;
return $wp_query->is_feed(); return $wp_query->is_feed( $feeds );
} }
/** /**
@ -2936,10 +2937,16 @@ class WP_Query {
* *
* @since 3.1.0 * @since 3.1.0
* *
* @param string|array $feeds Optional feed types to check.
* @return bool * @return bool
*/ */
function is_feed() { function is_feed( $feeds = '' ) {
if ( empty( $feeds ) || ! $this->is_feed )
return (bool) $this->is_feed; return (bool) $this->is_feed;
$qv = $this->get( 'feed' );
if ( 'feed' == $qv )
$qv = get_default_feed();
return in_array( $qv, (array) $feeds );
} }
/** /**