简体   繁体   中英

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 . This shows all the posts from "category_name" category. What I want here is to show a custom feed hosted from one of my other site & not the default 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..

for more info visit access cross domain feeds with php hope this will help you.

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.

See 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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