#8878 closed enhancement (fixed)
Allow theme developers to have feed links automatically outputted
Reported by: | Viper007Bond | Owned by: | Viper007Bond |
---|---|---|---|
Milestone: | 2.8 | Priority: | normal |
Severity: | normal | Version: | 2.7 |
Component: | Template | Keywords: | has-patch dev-feedback 2nd-opinion |
Focuses: | Cc: |
Description
Oddly enough this idea occurred to both Matt and I today without talking to each other before hand. Crazy.
Anyway, theme developers shouldn't have to hard code in the <link>
s or code up the logic to display the URL to a category, etc. feed in their theme's head. On the other hand, we can't just go and do it ourselves as browsers aren't smart enough to ignore duplicate feed links.
So I have a patch in the works where a theme developer can just call a function in their theme's functions.php
file and that will queue up automatically adding <link>
tags to the <head>
depending on current location (home, single, category, etc.).
Attachments (6)
Change History (32)
#4
@
16 years ago
Usage:
Remove all <link>
's from your theme that point at any of the feeds. Add automatic_feed_links();
to your theme's functions.php
file. Done.
@
16 years ago
Output the extra feeds without theme author intervention, make general feeds optional, minor improvements
#5
@
16 years ago
Per Matt's good suggestion:
99% (if not more) of themes don't output the <link>
to the feed when you're viewing a category, author, tag, etc. archive listing. Therefore we can safely automatically output those without requiring theme updates.
Only the default general feeds will need to be manually enabled to avoid duplicating what is hardcoded into most themes. This new patch also makes just one general feed rather than both RSS2 and Atom. However the pre-existing default_feed
filter can switch WordPress to using Atom by default rather than RSS.
This patch also makes feed_content_type()
output application/octet-stream
rather than a blank if it doesn't know about a feed type. Thanks to rmccue on that one.
#6
follow-up:
↓ 7
@
16 years ago
This is a nice idea. By way of reference, here's the code I use to do this in Tarski:
Would be great to be able to remove all that logic and leave it to core to sort out.
#7
in reply to:
↑ 6
@
16 years ago
Would be great to be able to remove all that logic and leave it to core to sort out.
Yep, you'd now just add automatic_feed_links();
to your theme's functions.php
and be done. :)
@
16 years ago
Keep two new functions in the same order, but move them to much earlier in the wp_head hook
#9
@
16 years ago
- Resolution set to fixed
- Status changed from new to closed
Seems to be working okay. Please reopen if anyone runs into any trouble.
#10
@
16 years ago
- Keywords needs-testing removed
- Resolution fixed deleted
- Status changed from closed to reopened
DD32 caught a bug with the single post's comments feed:
if the_title contains HTML (ie. added by a filter), Then its not being properly escaped
Incoming patch.
#13
@
16 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
More code nitpicking. Might as well do it now rather than after 2.8 final or even never.
#15
@
16 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
The default value key in feed_links()
was changed to feedtitle
, but in the body it is still referenced as rsstitle
.
#18
@
15 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Should the new feed links be located above the usual blog feed and blog comments feed links? I think the new links should be preferred--For example, when an user is searching something and he clicks on the browser's feed button, he should expect to get a search results feed instead of the blog feed.
#20
@
15 years ago
- Resolution set to fixed
- Status changed from reopened to closed
I doubt it. On my own browser (Camino), clicking the rss icon in the address bar will list all of the available feeds when several are present.
#21
follow-up:
↓ 25
@
15 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
However, it is not the case in Internet Explorer 7 and 8. In addition, shouldn't the more preferred feed be put at a higher position?
#22
@
15 years ago
I'd rather have the blog's feed, myself. but I suppose it's a personal preference. :-)
#24
@
15 years ago
oh dear no, please. no more options. there are too many. :D
the most natural option (for readers who aren't aware that a site may have multiple RSS feeds) should be enforced imo. best I know, that would mean the site's feed.
#25
in reply to:
↑ 21
@
15 years ago
- Resolution set to fixed
- Status changed from reopened to closed
Let's leave this closed please. The most important and used feed, i.e. the main blog feed, belongs on top.
Replying to peaceablewhale:
However, it is not the case in Internet Explorer 7 and 8.
Click the down arrow to the right of the RSS icon. You can pick from the list of feeds.
Nevermind, it's a templates thing.