Advertisements广告

If you maintain more than one blog or a forum, then you can display the RSS feed of your posts or articles from another website on your WordPress blog.如果你保持一个以上的博客或论坛,那么你可以显示您的职位或从另一个你的WordPress博客网站的文章RSS提要。 This would in turn give more exposure to your posts written else where.这反过来让更多的书面否则你的岗位上去。 Although there might be plugins to do this job, you can do this using just 2 lines of code.虽然可能有一些插件,做好这项工作,你可以这样做只用2行代码。 WordPress has a build in function to get the RSS feed of any website. WordPress有一个函数为基础,获取任何网站的RSS提要。

We used this query to get the RSS feed of our我们用这个查询来获取我们的RSS提要 Mobile Blog移动博客 in the sidebar.在工具栏。 Here is the code.下面是代码。

<?php include_once(ABSPATH . WPINC . '/rss.php'); “?PHP的include_once(ABSPATH。WPINC。'/ rss.php');
wp_rss('http://feeds2.feedburner.com/themobileblogin, 5); ?> wp_rss('http://feeds2.feedburner.com/themobileblogin,5);?“

The first line of code is to call to RSS core file of WordPress and in the second line we specify the feed URL and the number of posts to be displayed using the wp_rss() function.在第一行代码是调用的RSS WordPress的核心文件,并在第二行,我们指定供稿网址和职位号码显示使用wp_rss()函数。 You need to replace the feed URL with the URL you want to display in the sidebar.你需要替换的网址您想要显示在侧栏供稿网址。 You can see the Mobile Blog posts showing up in the sidebar of this blog using this method.你可以看到移动blog显示在此使用这种方法博客侧边栏了。

Feed from another blog

You can also do some formatting using the <ul> and <li> based on your current theme style.您也可以使用一些格式<ul>和<li>根据您当前的主题风格。

NB: If you are not comfortable adding the code, you might get some plugins to do the job, but it is always advisable to go with lesser number of plugins. 注意:如果您不舒服添加代码,您可能会得到一些插件做工作,但它始终是最好去较少的一些插件。

Thanks to感谢 WP Recipes可湿性粉剂食谱 for this tip.这提示。


5 Responses to “How to Display Any RSS Feed on Wordpress Blog” 5回应“如何显示在WordPress的博客任意的RSS”

  1. Also, if your theme supports widgets then you can directly add RSS widget to your blog sidebar另外,如果你的主题支持的部件,那么你可以直接添加RSS小工具到您的博客侧边栏

  2. Blogsdna Blogsdna says: 说:

    Yes, Widget supported themes can directly add RSS Widget which intern usages above code and rss.php to retrieve feeds是的,小工具支持的主题可以直接添加RSS窗口小部件的上面的代码和rss.php检索实习生惯例供稿

  3. [...] How to Display Any RSS Feed on Wordpress Blog [...] [...]如何显示在WordPress的博客任意的RSS [...]

  4. Small error in the code.小错误的代码。 Second line must be..第二行必须..
    wp_rss('http://feeds2.feedburner.com/themobileblogin', 5); ?> wp_rss('http://feeds2.feedburner.com/themobileblogin',5);?“

    The ending ' is missing.截至'缺失。

  5. Rob says: 罗布 说:

    What if you don't want the RSS to go to a sidebar, but the actual main body of your website?如果你不希望的RSS到一个工具,但实际主体您的网站? I belong to an organisation that is globla and I'd like its news to appear in th emain body of my spin-off site, not just in a sidebar?我属于一个组织,是globla,我想只是在侧边栏的新闻出现在我的自旋次emain体场外,而不是?

Leave a Reply留下回复