Aaron
Aaron

Reputation: 1832

Wordpress XML RPC - Latest posts within Category

I am using the JoeBlogs .Net wordpress wrapper by Alex James Brown. It just essentially makes all of the XML RPC calls available to .Net.

I have been using the GetRecentPosts(5) call, e.g. "Grab the 5 most recent posts", but this returns everything from the entire blog.

What if I want to simply grab the latest posts within Category X?

E.g. I want GetRecentPosts("My Category", 5);

Is this possible with the current XML RPC API?

I really don't want to have to resort to pulling down 20 ALLRecentPosts and then sub-filtering by category, because that will be so inefficient, as I will have one site calling the blog site to fetch this data..

Many thanks.

Upvotes: 2

Views: 1545

Answers (1)

Richard M
Richard M

Reputation: 14535

I don't think there is a default XML-RPC method that does this. However, you can add new methods by hooking into Wordpress's xmlrpc_methods filter (see below), although presumably that would mean you'd also have to add some code to your .Net wrapper.

add_filter('xmlrpc_methods', 'add_xmlrpc_method');

function add_xmlrpc_method($methods) {
    $methods['foo'] = 'bar';
    return $methods;
}

function bar($args) {
    …
}

Upvotes: 1

Related Questions