Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm wondering how/if I can access more than the most recent X posts defined in the wordpress settings. I've seen plugins that migrate all blog content through RSS, haven't poked around to see their methods.

Basically I manage a couple hundred WordPress blogs, and I'm building a newsletter generator for my clients. They want to be able to select a few posts and have the excerpts appear in the newsletter body. The sites are spread across multiple servers and the newsletter generator is being built on top of our CRM, so direct database queries would be difficult. RSS would be the cleanest, but I can't seem to figure out how to access more than 10 at a time (when 10 is set in the admin).

Any ideas?

share|improve this question
    
what do you mean by "10 is set in the admin"? –  gcb Apr 20 '11 at 21:37
add comment

6 Answers

up vote 2 down vote accepted

Codex has example snippet on how to use post_limits filter to override amount set in admin for feed.

if (isset ($query->query_vars['feed']) and ($query->query_vars['feed'] == 'ics')) 
    add_filter('post_limits','no_limits_for_feed'); 


function no_limits_for_feed($limits) { 
   return ('') ; 
}

http://codex.wordpress.org/Function_Reference/query_posts#Usage_Tips

share|improve this answer
1  
This may be an option, but I was hoping to avoid having to modify theme code on 700+ sites. –  bhamrick Dec 1 '10 at 19:35
1  
So this is what I ended up doing. My sites are spread across a handful of WordPress-Mu installs, so it's not literally hundreds of differing instances of WordPress on hundreds of servers. The problem was that I needed this functionality on only SOME of the sites within each Mu install. So I wrote a plugin that does this, wrote a script that updated the database to activate that plugin on the sites I needed. Done. Thanks for the help. –  bhamrick Dec 3 '10 at 0:46
add comment

A way to get your posts is to call the different pages of the rss feed in your newsletter generator. It's a safe approach that doesn't require to update your various Wordpress installations:

yourwebsite.com/feed -> get last 10 posts

yourwebsite.com/feed/?paged=2 -> get next 10 posts

And so on.

share|improve this answer
add comment

Unfortunately, what you're trying to do is generally frowned upon in most communities. What I hear you asking for is:

  • A way to remotely retrieve more than the default number of (recent posts)
  • Possibly retrieve all published posts for a site
  • Without having any direct interaction with the site itself (using RSS)

This is a practice commonly used to scrape content from blogs and republish it without the permission of the original author. That's why I say it's generally frowned upon. Most blog authors put a lot of time and energy into developing great content, so making it easy for a third party to leverage their hard work to add SEO credit to their own site is ... well ... sleezy.

That said, I will assume for the moment that you have legitimate reasons for scraping content from over 700 sites. In that case, I would recommend a separate, programatic method - not RSS. If you have legitimate login information for all of these sites (i.e. they are your sites and not someone else's) you can use WordPress built-in XML-RPC features to fetch the content.

Use the built-in XML-RPC library to pass a request to metaWeblog.getRecentPosts specifying the ID of the blog (usually 0 for single sites, but could be different in multi-site), your WordPress username, your WordPress password, and the number of posts to fetch (set this to -1 to receive them all).

The other site will respond with (a rather large) XML file containing the content which you can do with what you want. This can all happen behind the scenes, and the metaWeblog.getRecentPosts request will give you much more information than an RSS feed (including custom fields, which might be important to you).

share|improve this answer
add comment

If memory serves, passing -1 as the number of posts has the same effect. Not entirely sure how it gets tossed into a URL, though.

As an aside, if you're really into having 700+ sites, consider having a cron that svn updates or git pulls from a stable branch, from a private repository on a daily basis... Combined with a daily http call to wp-admin/upgrade.php. It'll save you a lot of hassles when upgrading or tweaking your sites -- in that it'll get done automatically.

share|improve this answer
add comment

you may want to use some RSS aggregator like FeedWordpress

share|improve this answer
add comment

If you go to Settings > Reading > and change the value in the "Syndication feeds show the most recent" to a number that suits you, it will show up to the number of feeds you input.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.