rss feed from one Wordpress site to another

31 views
Skip to first unread message

H is for Home

unread,
Feb 4, 2012, 6:07:22 PM2/4/12
to Manchester WordPress User Group
Hi everyone,

I've spent hours combing Codex & forums looking for an answer to this
query but haven't been having any joy!

I have two separate Wordpress websites and am trying to pull in a
single category of one feed into a page on the other. I don't merely
want to import what's already there, I want it to be kept updated each
time a new new post in that category is published.

Is there a plugin that can do this for me or a (simple) way to add
some code?

Any help much appreciated!

Thanks,
Adelle

John Davies

unread,
Feb 4, 2012, 6:37:45 PM2/4/12
to manchester-word...@googlegroups.com
Are you using the the same database for both Wordpress sites ?

> --
> See the group blog at http://mwug.info
>
> You received this message because you are subscribed to the Google
> Groups "Manchester WordPress User Group" group.
> To post to this group, send email to
> manchester-word...@googlegroups.com
> To unsubscribe from this group, send email to
> manchester-wordpress-...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/manchester-wordpress-user-group

--
John Davies

Mike Little

unread,
Feb 5, 2012, 7:23:47 AM2/5/12
to manchester-word...@googlegroups.com
Have a look at the Fetch Feed shortcode pageable plugin (http://wordpress.org/extend/plugins/fetch-feed-shortcode-pageable/ ). It allows you to add a shortcode to a page with the other site's feed url as a parameter and then pulls in the content from the other site. The display is configurable and there is a css file to style it.

For example, this shortcode 

[FetchFeedPageable feed="http://hisforhomeblog.com/category/pottery/feed/" pagesize=5 pagenum=5 linktitle="yes" target="_blank" itemelements="title,date,author,description" ]



Hope this helps,

Mike
-- 
Mike Little
http://zed1.com/

H is for Home

unread,
Feb 5, 2012, 3:26:21 PM2/5/12
to Manchester WordPress User Group
Hi Mike/John,

I managed to find the RssImport plugin http://wordpress.org/extend/plugins/rss-import/
late last night/wee hours of this morning. It's worked for me except
the paging="true" doesn't seem to work. Here's the url to my new, work-
in-progress site that's pulling in the feed: http://hisforhomecountry.com/

Again, any ideas gratefully welcomed!

Adelle

On Feb 5, 12:23 pm, Mike Little <m...@zed1.com> wrote:
> On Sat, Feb 4, 2012 at 23:07, H is for Home <he...@hisforhome.com> wrote:
>
> > Hi everyone,
>
> > I've spent hours combing Codex & forums looking for an answer to this
> > query but haven't been having any joy!
>
> > I have two separate Wordpress websites and am trying to pull in a
> > single category of one feed into a page on the other. I don't merely
> > want to import what's already there, I want it to be kept updated each
> > time a new new post in that category is published.
>
> > Is there a plugin that can do this for me or a (simple) way to add
> > some code?
>
> Have a look at the Fetch Feed shortcode pageable plugin (http://wordpress.org/extend/plugins/fetch-feed-shortcode-pageable/). It
> allows you to add a shortcode to a page with the other site's feed url as a
> parameter and then pulls in the content from the other site. The display is
> configurable and there is a css file to style it.
>
> For example, this shortcode
>
> [FetchFeedPageable feed="http://hisforhomeblog.com/category/pottery/feed/"
> pagesize=5 pagenum=5 linktitle="yes" target="_blank"
> itemelements="title,date,author,description" ]
>
> produces thishttp://wp-examples.com/external-feed-page

John Davies

unread,
Feb 5, 2012, 4:34:24 PM2/5/12
to manchester-word...@googlegroups.com
Hi,
Are the sites on the same database?
John

H is for Home

unread,
Feb 5, 2012, 5:31:29 PM2/5/12
to Manchester WordPress User Group
Hi John,

Yes, I think they are.

Adelle

On Feb 5, 9:34 pm, John Davies <johnamazindav...@gmail.com> wrote:
> Hi,
> Are the sites on the same database?
> John
>
> On 5 February 2012 20:26, H is for Home <he...@hisforhome.com> wrote:
>
>
>
>
>
>
>
>
>
> > Hi Mike/John,
>
> > I managed to find the RssImport pluginhttp://wordpress.org/extend/plugins/rss-import/
> > See the group blog athttp://mwug.info

John Davies

unread,
Feb 5, 2012, 6:48:35 PM2/5/12
to manchester-word...@googlegroups.com
Hi Adelle,
I have attached a text file containing code which you could put into
your functions file of the wordpress installation you wish to pull the
posts *into* .
I have put some comments at the top which explain what need to be done.
You then just need to loop through each of the results maybe use
setup_postdata in the loop. I can write all the code for you no
problem if you want.

Is this any use to you,if you need further help please dont hesitate to ask.

John

> See the group blog at http://mwug.info

external.txt

Mike Little

unread,
Feb 5, 2012, 6:49:24 PM2/5/12
to manchester-word...@googlegroups.com
On Sun, Feb 5, 2012 at 20:26, H is for Home <he...@hisforhome.com> wrote:
Hi Mike/John,

I managed to find the RssImport plugin http://wordpress.org/extend/plugins/rss-import/
late last night/wee hours of this morning. It's worked for me except
the paging="true" doesn't seem to work. Here's the url to my new, work-
in-progress site that's pulling in the feed: http://hisforhomecountry.com/

Again, any ideas gratefully welcomed!

Adelle


Hmmm, works for me http://wp-examples.com/external-feed-2, the next link pages through to the next lot of posts (I set display=5 and paging=1).


Mike

John Davies

unread,
Feb 5, 2012, 6:55:31 PM2/5/12
to manchester-word...@googlegroups.com
Mike,
Was that the site you have it working on, I get a message saying
'Error: Feed has a error or is not valid'? Looks more like it is
problem with the feed rather than the plugin though..
John

Mike Little

unread,
Feb 5, 2012, 6:58:59 PM2/5/12
to manchester-word...@googlegroups.com
On Sun, Feb 5, 2012 at 23:55, John Davies <johnamaz...@gmail.com> wrote:
Mike,
Was that the site you have it working on, I get a message saying
'Error: Feed has a error or is not valid'? Looks more like it is
problem with the feed rather than the plugin though..
John


You are probably seeing a cached version of an earlier error. I've just cleared the cache, try again.

Mike

John Davies

unread,
Feb 5, 2012, 7:02:42 PM2/5/12
to manchester-word...@googlegroups.com
No, still no joy I'm afraid. I clear out my browser cache as well.

Mike Little

unread,
Feb 5, 2012, 7:08:17 PM2/5/12
to manchester-word...@googlegroups.com
On Mon, Feb 6, 2012 at 00:02, John Davies <johnamaz...@gmail.com> wrote:
No, still no joy I'm afraid. I clear out my browser cache as well.


Hmmm... I'm getting it too if I log out.... wait. viewing source shows me the page is 15 minutes old. 

It looks like wp-super-cache's 'delete cache' button in the toolbar doesn't work! 

Logged in, cleared cache properly, now it works.

Mike
-- 
Mike Little
http://zed1.com/

John Davies

unread,
Feb 5, 2012, 7:14:46 PM2/5/12
to manchester-word...@googlegroups.com
I had that problem with that plugin too, I ended up un-installing the
plugin as it was causing me a few other problems too.
Regarding the feed page it now works well for me too. Looks like a
useful plugin, will have to add it my list.

John

Mike Little

unread,
Feb 5, 2012, 7:15:55 PM2/5/12
to manchester-word...@googlegroups.com
On Mon, Feb 6, 2012 at 00:14, John Davies <johnamaz...@gmail.com> wrote:
I had that problem with that plugin too, I ended up un-installing the
plugin as it was causing me a few other problems too.
Regarding the feed page it now works well for me too. Looks like a
useful plugin, will have to add it my list.

John


The other one ((I recommend earlier) worked first time.

Mike Little

unread,
Feb 5, 2012, 7:16:38 PM2/5/12
to manchester-word...@googlegroups.com
On Sun, Feb 5, 2012 at 23:48, John Davies <johnamaz...@gmail.com> wrote:
Hi Adelle,
I have attached a text file containing code which you could put into
your functions file of the wordpress installation you wish to pull the
posts *into* .
I have put some comments at the top which explain what need to be done.
You then just need to loop through each of the results maybe use
setup_postdata in the loop. I can write all the code for you no
problem if you want.

Is this any use to you,if you need further help please dont hesitate to ask.

John


John,

The problems with your example code, whilst it might seem to work, are several:

* You don't specify which taxonomy the term might be in, so you could end up pulling in the wrong posts. 
* No proper processing of the posts' content can possibly be carried out (because you need the plugins from the other site to do their work *on the other site*). So, no shortcodes expanded, ads inserted, galleries displayed, etc.
* You would pull in and show password protected posts without any prompt for passwords.
* There's no chronological order or sticky posts honoured.
* No author details are retrieved.
* and so on...

In other words, you are missing out all the processing that WordPress would do. Sucking in a feed, even though the other site might be on the same server, and even in the same database, will make sure all the processing required of the source site is carried out.

I always cringe when I see direct access to the database like that too. I haven't needed to write code like that in a long time. I know it's accessing another set of tables, but you should still be using $wpdb->prepare(). And it's always much simpler to use the proper WordPress API's to retrieve your data, than it is to try to do it by hand.


Mike

John Davies

unread,
Feb 5, 2012, 7:21:27 PM2/5/12
to manchester-word...@googlegroups.com
Mike,
Sorry yes you are correct.

John

H is for Home

unread,
Feb 6, 2012, 6:14:41 AM2/6/12
to Manchester WordPress User Group
Hi Mike/John,

I've played about with the display and paging numbers but it won't
change. Here's the whole snippet that I've used.

[RSSImport display="50" paging="5" html="true"
displaydescriptions="true" truncatedescchar="" feedurl="http://
hisforhomeblog.com/category/books/feed/"]

Can't think why it won't page!

Adelle

On Feb 6, 12:21 am, John Davies <johnamazindav...@gmail.com> wrote:
> Mike,
> Sorry yes you are correct.
>
> John
>
> On 6 February 2012 00:16, Mike Little <m...@zed1.com> wrote:
>
>
>
>
>
>
>
>
>
> > On Sun, Feb 5, 2012 at 23:48, John Davies <johnamazindav...@gmail.com>
> > See the group blog athttp://mwug.info

H is for Home

unread,
Feb 6, 2012, 6:23:19 AM2/6/12
to Manchester WordPress User Group
Also, I'd like to remove the title but can't seem to. The best I can
do is truncatetitlechar="1" as "0" / "..." / "empty" all don't seem to
work!

Adelle

Mike Little

unread,
Feb 6, 2012, 7:39:32 AM2/6/12
to manchester-word...@googlegroups.com
The display value is the number of items to display on one page, the paging value should be true or false (or 1 or 0) to enable  paging.

Your current settings aren't working because there are only 10 items returned from the feed. So it doesn't have more than a page full (50) to page through

I suspect what you want it display set to something like 5 or 10, paging set to 1 (or true), and you need to configure your feed at your source site to include 50 items (go to Settings -> reading -> "syndication feeds show the most recent" and set it to 50 , or whatever number you want)

It does look like it doesn't support hiding the title. The likely reason is that it expects to use the title as a link to the original article you are pulling in.

H is for Home

unread,
Feb 6, 2012, 9:38:29 AM2/6/12
to Manchester WordPress User Group
Thanks Mike for explaining exactly what each value does. I thought
'display' was how many posts to display in total!

Works now - thanks for all your help Mike and John.

Adelle
Reply all
Reply to author
Forward
0 new messages