简体   繁体   English

Wordpress json-api插件获取指定日期至今的最新帖子

[英]Wordpress json-api plugin get recent posts from specified date up to today

I am using a plugin for WordPress called json-api, and it has a function to get recent posts. 我正在使用一个名为json-api的WordPress插件,它具有获取最新帖子的功能。 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..... 我假设它仅在过去24小时内被调用,但是我想对其进行修改,因此我可以为其指定一个参数,使其在过去24小时或1天之前拉动,然后在2天两天内或48小时拉动,等等。 ..

This is the plugin: https://wordpress.org/plugins/json-api/ 这是插件: 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 这是指向get_recent_posts插件的示例链接

I have tried: http://alexbachuk.com/api/get_recent_posts&after=20140806/ 我已经尝试过: 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. 我要完成的是指定一个日期,然后获取该日期至今的所有帖子。

Okay, I have got it to work with this: http://alexbachuk.com/api/get_recent_posts/?after=20150806&count=400 好的,我可以使用它: http : //alexbachuk.com/api/get_recent_posts/?after=20150806&count=400

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM