Opened 14 years ago
Closed 14 years ago
#15460 closed enhancement (fixed)
Feed format parameter for is_feed()
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 3.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Feeds | Keywords: | has-patch |
Focuses: | Cc: |
Description
is_feed()
should accept an optional parameter so the feed format can be specified.
For example, a plugin of mine adds a feed format and a helper plugin which works with it needs a simple way to determine the format of the current feed.
I currently use:
function is_flow_feed() { return ( 'flow' === get_query_var( 'feed' ) ); }
Patch coming up.
Attachments (2)
Change History (7)
#3
@
14 years ago
Looks good. I'm making a few changes. Patch attached.
In line with is_singular() and a few others, I'm allowing this to accept an array to check.
Additionally, instead of get_query_var(), we need to use $this->get(). The point of moving the functions to methods is they always reflect the WP_Query object in question, not necessarily $wp_query.
Added docs and cleaned up the logic a little. The method's parameter also needs to be optional.
We also need to account for the query var being 'feed', if no feed is specified, which we'll need to catch by checking the default feed too.
Sane improvement.