1
votes

I am using a plugin for WordPress called json-api, and it has a function to get recent posts. I am assuming its only called within the last 24 hours, but I wanted to modify it so I could give it a parameter to pull specifically by last 24 hours or 1 for days, then 2 for two days or 48 hours, ect.....

This is the plugin: https://wordpress.org/plugins/json-api/

I am able to modify the plugin if need too.

This is the function for that:

public function get_recent_posts_by_day() {
global $json_api;
$posts = $json_api->introspector->get_posts();
return $this->posts_result($posts);}

Here is an example link to the plugin for get_recent_posts

I have tried: http://alexbachuk.com/api/get_recent_posts&after=20140806/

What I want to accomplish is either specifying a date and get all post from that date up until today.

1
First of all, you need to correct the URL for calling the API alexbachuk.com/api/get_recent_posts/?after=2014-08-06 Notice the slash (/) after get_recent_posts - Dragos
Did you already try to update the code? If so, what were the updates and what was the result of that? Are there any errors? Or are you looking for someone to implement it for you? - Dragos

1 Answers

0
votes

Okay, I have got it to work with this: http://alexbachuk.com/api/get_recent_posts/?after=20150806&count=400

Fix: /api/get_recent_posts/?after=20150806&count=400