wordpress本地开发_WordPress提要开发人员指南
本地开发
A feed is a data used for users with . Feed are used to read a feed, users to to it. a of feeds in one spot is known as , which is by a feed .
提要是一种数据格式,用于为用户提供频繁更新的内容。 提要阅读器用于阅读提要,从而允许用户订阅它。 使一个集合的提要可以在一个位置访问是众所周知的聚合,这是由一个提要聚合器执行的。
In this I’ll show you the kinds of feed by and how to them, with a focus on them .
在本教程中,我将向您展示提供的各种提要格式以及如何访问它们,重点是以编程方式自定义它们。
支持的提要格式 (Feed by )
four feed : RDF, RSS 0.92, RSS 2.0 and Atom. RSS 2.0 is the most feed and is by every feed .
支持四种流行的提要格式:RDF,RSS 0.92,RSS 2.0和Atom。 RSS 2.0是最流行的提要格式,几乎每个提要阅读器都支持它。
The URL paths for these feeds are:
这些提要的URL路径是:
http://example.com/?feed=rss
http://example.com/?feed=rss2
http://example.com/?feed=rdf
http://example.com/?feed=atom
You don’t have to them into your or , you can just use the to the URLs of the feed :
您不必将它们硬编码到主题或插件中,只需使用以下功能即可检索各种提要格式的URL:
These URLs the ‘posts’ of the site.
这些URL检索网站的最新“帖子”。
最近评论提要 ( Feed)
The above paths the posts of the site. To find we need to use the feed path:
以上路径提供了该网站的最新帖子。 要查找最近的评论,我们需要使用评论特定的供稿路径:
http://example.com/?feed=comments-rss2
If you don’t want to it, you can use this to the feed:
如果您不想对其进行硬编码,则可以使用此函数来检索注释提要:
also a feed for of a post. To find the of a post the feed path is:
还提供了供稿,用于评论单个帖子。 要查找特定帖子的最新评论,提要路径为:
http://example.com/?p=id&feed=rss2
Again, if you don’t want to it, you can use this to it:
同样,如果您不想对其进行硬编码,则可以使用以下函数进行检索:
分类供稿 ( Feed)
a feed for every . The feed path for a or is:
提供了每个类别的供稿。 单个类别或多个类别的提要路径为:
http://www.example.com/?cat=id1,id2&feed=rss2
You can use this to the feed URL of a or by using the :
您可以使用此功能通过以下方式检索单个类别或多个类别的提要URL:
, you can also get the feed URL of a tag or tags too.
同样,您也可以获取一个标签或多个标签的Feed URL。
作者提要 ( Feed)
also a feed for the posts of an . This is if a user wants to a via a feed.
还为作者的最新帖子提供了提要。 如果用户想通过提要关注特定作者,这将很有用。
The URL path of an ’s feed can be using the below code:
可以使用以下代码构造作者提要的URL路径:
ID, $authordata->user_nicename) . 'feed/">' . the_author($idmode, false) . '';
Note: doesn’t any built-in to the URL of an feed.
注意:没有提供任何内置功能来检索作者供稿的URL。
搜索供稿 ( Feed)
can also a feed for a term. Here’s the feed URL path for a term:
还可以检索搜索词的提要。 以下是搜索字词的供稿网址路径:
http://example.com/?s=sitepoint&feed=rss2
查看提要请求 (Check Feed )
In your theme or , you can check if a is a feed or not by using the below code:
在主题或插件中,可以使用以下代码检查请求是否为供稿请求:
Here we are using the () to check if the is a feed or not. If yes, then it true.
在这里,我们使用()函数检查当前请求是否为feed请求。 如果是,则返回true。
uses a built in feed to feeds. Using the we can our own feed .
内部使用内置的提要模板来显示提要。 使用操作,我们可以定义自己的提要模板。
删除提要 ( Feeds)
If you don’t want to feeds on your site, then you can use the code below to all of them:
如果您不想在您的网站上提供供稿,则可以使用以下代码禁用所有供稿:
过滤Feed内容 ( Feed )
To the of a post in a feed only we can use . Here is an on how to use it:
要仅过滤Feed中帖子的描述,我们可以使用过滤器。 这是有关如何使用它的示例:
function feed_word_count($content)
{
$content .= 'Total '.str_word_count($content).' words';
return $content;
}
add_filter("the_content_feed", "feed_word_count");
自动提要链接 ( Feed Links)
In 3.0 , there is a theme to add feed URLs to the head tag. If you’re a theme , then add this line of code to your theme’s .php file to this .
在 3.0及更高版本中,提供了主题支持功能,可将供稿URL添加到head标签。 如果您是主题开发人员,请将此代码行添加到主题的.php文件中以启用此功能。
add_theme_support( 'automatic-feed-links' );
将提要重定向到提要 ( Feeds to Feeds)
Many site to their feeds using (or other third party ). This lets them track their feeds and of .
许多站点管理员更喜欢使用 (或其他第三方服务)提供其提要。 这样一来,他们就可以跟踪自己的供稿和订阅者人数。
The dirty way to do this is by the below code to . file
这样做的肮脏方法是将以下代码添加到.文件中
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !FeedBurner [NC]
RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]
RewriteRule ^feed/?([_0-9a-z-]+)?/?$ http://feeds.feedburner.com/name [R=302,NC,L]
This code to the posts feed to .
此代码将请求重定向到的最新帖子提要。
If you’re to touch your . file, then you can use to do the same thing.
如果您不愿意触摸.文件,则可以使用插件执行相同的操作。
更多动作和过滤器 (More and )
many more and to our feeds. We’ve only some of the most and ones.
提供了更多的操作和过滤器来定制我们的提要。 我们仅介绍了一些最重要和最有用的内容。
You can find many more feed at and at .
您可以在操作参考中找到更多与提要相关的操作,并在过滤器参考中找到过滤器 。
结论 ()
Many users feed than email or . As feed are now for all it’s a good idea to users an to via feeds, with RSS 2.0 being the . You also an feed and a feed if you have , not just posts feed.
许多用户更喜欢订阅订阅,而不是电子邮件或社交订阅。 由于feed聚合器现在可用于所有平台,因此最好为用户提供通过feed订阅的选项,其中RSS 2.0是首选格式。 如果您已启用评论功能,那么您还应该显示作者信息源和评论信息源,而不仅仅是最近的帖子信息源。
Let me know your with feeds below.
在下面让我知道您对 feed的体验。
翻译自:
本地开发