获得更多的WordPress帖子

Getting more amount of WordPress posts

本文关键字:WordPress 帖子      更新时间:2023-09-26

我试图从WP帐户中获得超过默认数量的帖子,默认是10,我需要至少20,这就是我做的方式

getBlogs: function($scope) {
  $scope.postsURL = 'http://urbanetradio.com/wp-json/posts?filter[posts_per_page]=20&filter[order]=ASC_jsonp=JSON_CALLBACK';
  $http.jsonp($scope.postsURL).success(function(data, status, headers, config) {
    $scope.posts = data;
  })
}

这是我正在使用的插件http://wp-api.org/

这是一个Plnuker,以防万一

如果你把那个链接放到邮差里,你会得到一个STATUS 200 OK但在我的应用里,它会给我一个错误

你认为发生了什么?

您的查询字符串格式错误,即应该读

http://urbanetradio.com/wp-json/posts?filter[posts_per_page]=20&filter[order]=A‌​SC&jsonp=JSON_CALLBACK

。需要用&号分隔_json=...参数&