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.如果你保持一個以上的博客或論壇,那麼你可以顯示RSS提要您的帖子或文章從其他網站上你的WordPress博客。 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回應“如何顯示任意的RSS上的WordPress博客”

  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 [...] [...]如何顯示任意的RSS上的WordPress博客[...]

  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留下回复