diff --git a/lib/post/post.service.coffee b/lib/post/post.service.coffee
index 45d758957..0bd0c83d5 100644
--- a/lib/post/post.service.coffee
+++ b/lib/post/post.service.coffee
@@ -1,6 +1,6 @@
md5 = require 'MD5'
-module.exports = angular.module('wordpress-hybrid-client.post').factory '$WPHCPost', ($log, $wpApiPosts, $wpApiComments, $q, $WPHCConfig, CacheFactory) ->
+module.exports = angular.module('wordpress-hybrid-client.post').factory '$WPHCPost', ($log, $wpApiPosts, $wpApiMedia, $wpApiComments, $q, $WPHCConfig, CacheFactory) ->
$log.info '$WPHCPost'
getCommentsCache = () ->
@@ -13,6 +13,12 @@ module.exports = angular.module('wordpress-hybrid-client.post').factory '$WPHCPo
return CacheFactory.get 'post'
CacheFactory 'post', _.get $WPHCConfig, 'post.cache'
+ getFeatureImage: (featureImageId) ->
+ return $q.when(null) if !featureImageId or featureImageId is 0
+ return $wpApiMedia.get featureImageId
+ .then (response) ->
+ response.data
+
getComments: (id) ->
deferred = $q.defer()
hash = md5 $WPHCConfig.api.baseUrl + id
@@ -25,6 +31,9 @@ module.exports = angular.module('wordpress-hybrid-client.post').factory '$WPHCPo
post: id
status: "approved"
type: "comment"
+ orderby: 'date'
+ order: 'asc'
+ per_page: _.get($WPHCConfig, 'post.comments.per_page') || 50
.then (response) ->
getCommentsCache().put 'item-comments-' + hash, response.data
deferred.resolve response.data
diff --git a/lib/posts/posts.service.coffee b/lib/posts/posts.service.coffee
index 7a8c38112..60f37e4f0 100644
--- a/lib/posts/posts.service.coffee
+++ b/lib/posts/posts.service.coffee
@@ -15,10 +15,10 @@ module.exports = angular.module('wordpress-hybrid-client.posts')
getQuery: (page) ->
page: page
"_embed": true
- "filter[posts_per_page]": $WPHCConfig.posts.posts_per_page
- "filter[orderby]": $WPHCConfig.posts.orderby
- "filter[order]": $WPHCConfig.posts.order
- "filter[post_status]": $WPHCConfig.posts.post_status
+ "filter[posts_per_page]": _.get($WPHCConfig, 'posts.per_page') || 5
+ "filter[orderby]": _.get($WPHCConfig, 'posts.orderby') || 'date'
+ "filter[order]": _.get($WPHCConfig, 'posts.order') || 'desc'
+ "filter[post_status]": _.get($WPHCConfig, 'posts.post_status') || 'publish'
getList: (query) ->
queryString = JSON.stringify query
diff --git a/package.json b/package.json
index f2c0775a6..ae04b1c15 100644
--- a/package.json
+++ b/package.json
@@ -94,6 +94,6 @@
"moment": "^2.9.0",
"ng-cordova": "^0.1.20-alpha",
"v-accordion": "~1.3.1",
- "wp-api-angularjs": "^2.0.0-alpha2"
+ "wp-api-angularjs": "^2.0.0-alpha3"
}
}