简体   繁体   English

在我的wordpress网站上显示第三方供稿

[英]Show third-party feed on my wordpress site

I have this wordpress site & the feed for categoy is shown as http://site.com/category/category_name/feed . 我有这个wordpress网站,类别的供稿显示为http://site.com/category/category_name/feed This shows all the posts from "category_name" category. 这将显示“ category_name”类别中的所有帖子。 What I want here is to show a custom feed hosted from one of my other site & not the default wordpress rss feed. 我在这里想要显示的是来自其他网站之一的自定义Feed,而不是默认的wordpress rss feed。

Is this possible? 这可能吗?

try with this 试试这个

$xml = '//site.com/category/category_name/feed';
            $doc = new DOMDocument();
            $doc->load($xml);
            $item = $doc->getElementsByTagName('item');

            //$data = array();

            for($i=0; $i<=3; $i++){
                $title = $item->item($i)->getElementsByTagName('title')->item(0)->childNodes->item(0)->nodeValue;
                $link = $item->item($i)->getElementsByTagName('link')->item(0)->childNodes->item(0)->nodeValue;
                echo '<a href="' . $link . '" target="_blank"><h2>' . $title . '</h2></a>';
            }

and past this php code from where you want to display the feeds.. 并从您要显示提要的位置过去此php代码。

for more info visit access cross domain feeds with php hope this will help you. 有关更多信息,请 访问使用php的跨域供稿, 希望这会对您有所帮助。

There are many different ways to display a feed from another site in a WP site, either just the feed or the complete feed content as a post. 有很多不同的方法来显示WP站点中另一个站点的提要,无论是提要还是将完整的提要内容显示为帖子。

See FeedWordPress | 查看FeedWordPress | simple and flexible Atom/RSS syndication for WordPress and WordPress › SimplePie Plugin for WordPress « WordPress Plugins and Developer's Guide - Google AJAX Feed API - Google Code and Magpie RSS - PHP RSS Parser 适用于WordPressWordPress的 简单且灵活的Atom / RSS联合 ›适用于WordPress的SimplePie插件«WordPress插件开发人员指南 -Google AJAX Feed API-Google Code and Magpie RSS-PHP RSS Parser

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM