编辑“WordPress:Customizing Feeds

跳转至: 导航、​ 搜索
警告:您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您登录创建一个账户,您的编辑将归属于您的用户名,且将享受其他好处。

该编辑可以被撤销。 请检查下面的对比以核实您想要撤销的内容,然后发布下面的更改以完成撤销。

最后版本 您的文本
第1行: 第1行:
If terms like '''[[WordPress:Glossary#Feed|feed]]''', '''syndication''', and '''RSS''' make your head spin, stop right now and read an [[WordPress:Introduction_to_Blogging#Syndication|Introduction to Syndication]]. That will give you a [[WordPress:WordPress Feeds|good overview of feeds]] and syndication. We have an article on [[WordPress:WordPress Feeds]] to help you understand the basics, if you need them, but from here on, this article assumes that you know the basics of what feeds are and how they are used.
如果象'''[[WordPress:Glossary#Feed|feed]]''','''syndication''', 和 '''RSS'''这些词语让你头脑发晕,现在就停下来读读[[WordPress:Introduction_to_Blogging#Syndication|Syndication介绍]]。这会给你一个[[WordPress:WordPress Feeds| feed总览]],包括syndication。如果你需要的话,我们有一个关于[[WordPress:WordPress Feeds|WordPress Feeds]]的文章,帮助你理解基础,从这里开始,本文假设你懂得feed是什么和如何使用它们。
如果象'''[[WordPress:Glossary#Feed|feed]]''','''syndication''', 和 '''RSS'''这些词语让你头脑发晕,现在就停下来读读[[WordPress:Introduction_to_Blogging#Syndication|Syndication介绍]]。这会给你一个[[WordPress:WordPress Feeds| feed总览]],包括syndication。如果你需要的话,我们有一个关于[[WordPress:WordPress Feeds|WordPress Feeds]]的文章,帮助你理解基础,从这里开始,本文假设你懂得feed是什么和如何使用它们。


定制feed,给你的读者更多关于你和你的blog的信息:你可以把附加的合作伙伴的名字放到你的blog文章上,或者连接到朋友的朋友。反之,它同样也可以帮助你限制syndication可以获得的信息,通过移除外来数据或者提供机器可读的你的版权声明。
Customized feeds give your readers more information about you and your blog: you can include the names of additional collaborators on your blog posts, or a link to your Friend-of-a-Friend file. Contrariwise, it can also help you restrict the information available for syndication, by removing extraneous data or providing a machine-readable version of your copyright statement.
 
制定feed,给你的读者更多关于你和你的blog的信息:你可以把附加的合作伙伴的名字放到你的blog文章上,或者连接到朋友的朋友。反之,它同样也可以帮助你限制syndication可以获得的信息,通过移除外来数据或者提供机器可读的你的版权声明。
 
==How WordPress Produces Feeds==
 
WordPress uses a set of feed templates to display your site's feeds, in much the same way as it uses theme templates to display your content. These feed templates are located in the main WordPress directory; they are not compatible with the Theme system.


==WordPress如何生成Feeds==
==WordPress如何生成Feeds==
WordPress使用了feed的模板集合来显示你的页面feed,多数情况下和使用主题模板显示内容相同。这些feed模板在WordPress主目录中,它们和主题系统并不一致。
WordPress使用了feed的模板集合来显示你的页面feed,多数情况下和使用主题模板显示内容相同。这些feed模板再WordPress主目录中,它们和主题系统并不一致。
 
The following feed templates are included with WordPress:
; wp-rss2.php : Displays your entries in [http://www.rssboard.org/rss-specification RSS 2.0] format.
; wp-rss.php : Displays your entries in [http://backend.userland.com/rss092 RSS 0.92] format.
; wp-rdf.php : Displays your entries in [http://purl.org/rss/1.0/ RDF/RSS 1.0] format
; wp-atom.php : Displays your entries in [http://www.atomenabled.org/ Atom] format.
; wp-commentsrss2.php : Displays comments - either the most recent comments on all posts, or the comments on a specific post - in RSS 2.0 format.


WordPress包含下边的feed模板:
WordPress包含下边的feed模板:
第12行: 第27行:
; wp-atom.php : 使用 [http://www.atomenabled.org/ Atom]格式显示你的登陆口。
; wp-atom.php : 使用 [http://www.atomenabled.org/ Atom]格式显示你的登陆口。
; wp-commentsrss2.php : 显示评论 – 可以是所有文章的最新评论也可以是某个特定文章的评论 - RSS 2.0 格式。
; wp-commentsrss2.php : 显示评论 – 可以是所有文章的最新评论也可以是某个特定文章的评论 - RSS 2.0 格式。
== Customizing Your Feeds ==
There are a variety of ways to customize your feeds, through the use of third-party software you install and add-on to your WordPress site, or by manually changing the feed templates to meet your needs.


== 定制Feed ==
== 定制Feed ==
有多种方法来定制你的feed,通过你安装并用于WordPress站点的第三方软件,或者手动的更改feed模板来满足你的要求。
有多种方法来定制你的feed,通过你安装并用于WordPress站点的第三方软件,或者手动的更改feed模板来打到你的要求。


=== Third-Party Software ===
Some third-party web services can help you manage and customize your feeds. Using such services can be a simple way to do things like counting the number of people who read your feed, or combining your blog's feed with your Flickr photostream.
Such services include:
*[http://www.feedburner.com/ FeedBurner] - see [[WordPress:Using FeedBurner]]
*[http://www.rssmix.com/ RSS Mix] - merge multiple RSS feeds into a single stream


=== 第三方软件 ===
=== 第三方软件 ===
第24行: 第49行:
*[http://www.rssmix.com/ RSS Mix] – 合并多种RSS feed。
*[http://www.rssmix.com/ RSS Mix] – 合并多种RSS feed。


===定制feed模板===
===Customizing Feed Templates===
 
Editing your feed templates is much the same as editing your theme templates. However, feed templates are not integrated into the WordPress theme system; if you would like different versions of your feeds, you'll need to create extra feed templates or apply [http://wordpress.org/support/topic/25905 this patch] to your WordPress installation.
 
===制定feed模板===


编辑你的feed模板很大程度上和编辑你的主题模板一样。尽管如此,feed模板并没有统一到 WordPress模板系统中;如果你想要不同的feed,你需要创建额外的feed模板或者在你的WordPress安装中应用[http://wordpress.org/support/topic/25905 这个补丁]。
编辑你的feed模板很大程度上和编辑你的主题模板一样。尽管如此,feed模板并没有统一到 WordPress模板系统中;如果你想要不同的feed,你需要创建额外的feed模板或者再你的WordPress安装中应用[http://wordpress.org/support/topic/25905 这个补丁]。
 
Many specialized template tags exist specifically to format your content in a way that complies with the RSS standards. They include:
*[[WordPress:Template_Tags/the_category_rss|the_category_rss]]
*[[WordPress:Template_Tags/comment_author_rss|comment_author_rss]]
*[[WordPress:Template_Tags/comment_text_rss|comment_text_rss]]
*[[WordPress:Template_Tags/permalink_comments_rss|permalink_comments_rss]]
*[[WordPress:Template_Tags/comment_link_rss|comment_link_rss]]
*[[WordPress:Template_Tags/bloginfo_rss|bloginfo_rss]]
*[[WordPress:Template_Tags/the_title_rss|the_title_rss]]
*[[WordPress:Template_Tags/permalink_single_rss|permalink_single_rss]]
*[[WordPress:Template_Tags/the_content_rss|the_content_rss]]
*[[WordPress:Template_Tags/the_excerpt_rss|the_excerpt_rss]]
 
Let's look at some examples of how to use these template tags with your WordPress site feeds.


很多特殊存在的专门的模板标签是用来根据RSS标准格式化你的内容的 。包括:
很多特殊存在的专门的模板标签是用来根据RSS标准格式化你的内容的 。包括:
第40行: 第83行:
*[[WordPress:Template_Tags/the_content_rss|the_content_rss]]
*[[WordPress:Template_Tags/the_content_rss|the_content_rss]]
*[[WordPress:Template_Tags/the_excerpt_rss|the_excerpt_rss]]
*[[WordPress:Template_Tags/the_excerpt_rss|the_excerpt_rss]]
==== '''Make PubDate Work with Wordpress 2.2''' ====
With regards to the below, <tt>wp-rss2.php</tt> no longer has the pubDate command, but <tt>/wp-includes/feed-rss2.php</tt> does on lines 20, and 22.
If you are American, I suggest replacing said lines with the below:
<pre><pubDate><?php echo mysql2date('m-d-Y', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
</pre>


==== '''让PubDate 在Wordpress 2.2中使用''' ====
==== '''让PubDate 在Wordpress 2.2中使用''' ====
第48行: 第100行:
<pre><pubDate><?php echo mysql2date('m-d-Y', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
<pre><pubDate><?php echo mysql2date('m-d-Y', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
</pre>
</pre>
==== Make PubDate Work with Non-English Dates ====
The default [[WordPress:Glossary#RSS|RSS]] 2.0 feed in WordPress 1.5 displays the date elements of posts using some language-specific terms, i.e., day and month names. If you're using a localized version (non-English) of WordPress, some feed readers may not correctly interpret these names, causing errors in display and/or validation. '''If you are using a WordPress version later than 1.5.1, the problem with [http://trac.wordpress.org/ticket/891/ international dates in feeds] has been fixed.'''


==== 让PubDate 可以用于非英语的日期 ====
==== 让PubDate 可以用于非英语的日期 ====
WordPress 1.5中,默认[[WordPress:Glossary#RSS|RSS]]2.0feed使用一些语言相关的条目显示文章的日期元素,如日和月的名字。如果你用地方版本(非英语)的WordPress,一些feed读取器可能不能正确的分隔这些名字,导致显示错误或者非法操作。'''如果你使用WordPress 1.5.1之后的版本, [http://trac.wordpress.org/ticket/891/ feed的国际时间]的问题已经被修正了.'''
WordPress 1.5中,默认[[WordPress:Glossary#RSS|RSS]]2.0feed使用一些语言相关的条目显示文章的日期元素,如日和月的名字。如果你用地方版本(非英语)的WordPress,一些feed读取器可能不能正确的分隔这些名字,导致显示错误或者非法操作。'''如果你使用WordPress 1.5.1之后的版本, [http://trac.wordpress.org/ticket/891/ feed的国际时间]的问题已经被修正了.'''


To solve this problem in prior versions of WordPress, open <tt>wp-rss2.php</tt> and change the entry '''pubDate''' element from:
<pre>
<pubDate>
<?php echo mysql2date('D, d M Y H:i:s +0000', get_the_time('Y-m-d H:i:s')); ?>
</pubDate>
</pre>
to:
<pre>
<pubDate>
<?php echo mysql2date('r', get_the_time('Y-m-d H:i:s')); ?>
</pubDate>
</pre>


为了解决老版本WordPress的这个问题,打开<tt>wp-rss2.php</tt>改变'''pubDate'''的内容,把下边内容:
为了解决老版本WordPress的这个问题,打开<tt>wp-rss2.php</tt>改变'''pubDate'''的内容,把下边内容:
第60行: 第128行:
</pubDate>
</pubDate>
</pre>
</pre>
改成:
该成:
<pre>
<pre>
<pubDate>
<pubDate>
第66行: 第134行:
</pubDate>
</pubDate>
</pre>
</pre>
The 'r' is a generic [http://www.php.net/date PHP date format] that does not rely on translated strings.


'r'是一类不依赖于标准字符串的[http://www.php.net/date PHP 日期格式]。  
'r'是一类不依赖于标准字符串的[http://www.php.net/date PHP 日期格式]。  
==== Adding Entry Titles to Your Comments Feed ====
This example sets the title of each item in your comments RSS feed from <b>By: Harriet</b> to <b>Harriet on Sample Post</b>, which helps provide some context when reading the main feed of all comments on your blog. Because <tt>the_title_rss</tt> doesn't work outside [[WordPress:The Loop]], it's necessary to duplicate part of its function in your template.


==== 给评论feed添加登陆口标题 ====
==== 给评论feed添加登陆口标题 ====
这个例子是:在你的RSS feed中,从<b>By: Harriet</b>到<b>Harriet on Sample Post</b>,设置每个项目的标题。这对阅读blog上所有评论的主feed时提供一些上下文是有帮助的。因为<tt>the_title_rss</tt>不能工作在[[WordPress:The Loop|Loop]]之外,它的功能在你的主题中是必须的部分
这个例子是:在你的RSS feed中,从<b>By: Harriet</b>到<b>Harriet on Sample Post</b>,设置每个项目的标题。这对阅读blog上所有评论的主feed时提供一些上下文是有帮助的。因为<tt>the_title_rss</tt>不能工作在[[WordPress:The Loop|Loop]]之外,它的功能在你的主题中是必须的部分


如下代码应该放在<tt>wp_commentsrss2.php</tt>中,在评论loop开始之后的地方:
The following code should be put in <tt>wp_commentsrss2.php</tt>, just after the beginning of the comment loop:
 
如下代码应该放在<tt>wp_commentsrss2.php</tt>中,再评论loop开始之后的地方:


<pre><nowiki>
<pre><nowiki>
第88行: 第163行:
</nowiki></pre>
</nowiki></pre>


相应的,[http://freepressblog.org/2005/06/17/titles-in-wordpress-rss-comments/ 这个插件]将在不破坏wordpress安装的情况下得到相同的结果。
Alternatively, [http://freepressblog.org/2005/06/17/titles-in-wordpress-rss-comments/ this plugin] will achieve the same result without hacking your wordpress install.
 
相应的,[http://freepressblog.org/2005/06/17/titles-in-wordpress-rss-comments/ 这个插件]将再不破坏wordpress安装的情况下得到相同的结果。
 
== Checking Your New Feed ==
To see your new feed, you can use any of the many feed readers available on the Internet.  While your feed might look good to you in the different readers, it might still have problems.


== 检查新的Feed ==
== 检查新的Feed ==
要看你的新的Feed,你可以在因特网上使用任何feed读取器。如果feed在那个读取器中看起来正常的话,在别的读取器中可能会出问题。
要看你的新的Feed,你可以使用任何feed读取器。如果feed在哪个读取器中看起来正常的话,再别的读取器中可能会出问题。
 
Feed formats are designed to be read and manipulated by machines; errors in your feed template can make your feed unreadable to some or all feedreaders. So after you make all your changes, it's a good idea to check that your feed meets the relevant standards. Validation services include:


*[http://feedvalidator.org/ Feedvalidator.org] - for Atom and RSS feeds.
*[http://www.ldodds.com/rss_validator/1.0/validator.html Experimental RSS 1.0 Validator]
*[http://librdf.org/rss/ Redlands RSS 1.0 Validator]
*[http://feeds.archive.org/validator/ Feeds.archives.org]


Feed格式设计成机器可以读并操作的类型;feed模板中的错误可能导致某些feed读取器无法读取你的feed。所以做完所有你要做的更改之后,检查你的feed是否达到相关标准是必须的。确认服务包括:
Feed格式设计成机器可以读并操作的类型;feed模板中的错误可能导致某些feed读取器无法读取你的feed。所以做完所有你要做的更改之后,检查你的feed是否达到相关标准是必须的。确认服务包括:
第100行: 第186行:
*[http://librdf.org/rss/ Redlands RSS 1.0 校验器]
*[http://librdf.org/rss/ Redlands RSS 1.0 校验器]
*[http://feeds.archive.org/validator/ Feeds.archives.org]
*[http://feeds.archive.org/validator/ Feeds.archives.org]
== More Information and Resources ==
*[http://snook.ca/archives/rss/add_logo_to_feed/ Add a logo to your Atom or RSS feed]
*[http://wordlog.com/archives/2004/08/01/add-an-image-to-your-rss-20-field/ How to add an image to your RSS 2.0 feed] site getting errors 04/28/07
*[http://www.onenaught.com/posts/20/adding-a-logo-to-your-wordpress-rss-feed Adding a logo to your WordPress RSS Feed]
*[http://www.oreillynet.com/pub/a/network/2000/08/25/magazine/rss_tut.html Tutorial on Writing RSS 1.0]
*[http://www.disobey.com/detergent/2002/extendingrss2/ Extending RSS 2.0 with Namespaces]
*[http://fernando-graphicos.com/rss-style-for-your-wp-feed/ RSS Style for Your WordPress Feed]


== 更多信息和资源 ==
== 更多信息和资源 ==
请注意,您对站长百科的所有贡献都可能被其他贡献者编辑,修改或删除。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源(参阅Wordpress-mediawiki:版权的细节)。 未经许可,请勿提交受版权保护的作品!
取消 编辑帮助(在新窗口中打开)

本页使用的模板: