I have a friend who writes to a couple of different blogs and wants to pull stories from one that isn’t so popular, onto his main blog with an rss feed and display an image from it too (since rss feeds have images, sometimes).
Displaying the rss feeds shouldn’t be too hard, it’s making them a custom post type that seems more difficult to me.
If anyone has any ideas, shoot.
EDIT:-
Does anyone know how to get an external rss feed to appear as a custom post type in wordpress?
A simple way may be to use WordPress’ own
fetch_feed
function:http://codex.wordpress.org/Function_Reference/fetch_feed
A quick example (assuming you’ve already set up your custom post type):
If there is an image tag in the content you could use php’s DomDocument class to grab the url and upload it to your server so you can set it as the featured image.
http://codex.wordpress.org/Function_Reference/wp_insert_attachment
http://codex.wordpress.org/Function_Reference/set_post_thumbnail
Edit
corrected the timestamp check. This updated example uses the ‘wp’ hook to run so you can see the results quicker. It would be preferable to set this as a cron task. See http://codex.wordpress.org/Function_Reference/wp_schedule_event
The Feed to Post plugin is the perfect solution for importing multiple RSS items into your WordPress blog, you can even store them as posts or custom post types.
http://www.wprssaggregator.com/extension/feed-to-post/
Unfortunately I don’t know a way off hand, but have you looked at modifying a plugin? There are tons of content curation plugins around (feedwordpress, autoblog, etc.). You could probably find the
wp_insert_post()
line somewhere and modify it to include your custom post type/taxonomies.EDIT
Jumped into the plugin (feedwordpress) myself, and all the
insert_post
stuff is insyndicatedpost.class.php
– the mainwp_insert_post()
on line 1538EDIT if you fancy a giggle while reading throught that plugin code, you’ll find many an instance of the f word… haha
Hey why dont you try this http://wordpress.org/extend/plugins/display-latest-rss-feeds/
It would pull rss feeds from any account and display it to your blog. Unfortunately it wont display images just the rss feeds title and its permalink to the original blog but you can easily modify the source code if you want.