Thread Starter
kazack
(@kazack)
I did it 🙂
Edit json-rest-api/lib/class-wp-json-posts.php (WP REST API plugin):
1. Find line:
public function get_posts( $filter = array(), $context = ‘view’, $type = ‘post’, $page = 1) {
$query = array(
);
2. Replace with:
public function get_posts( $filter = array(), $context = ‘view’, $type = ‘post’, $page = 1) {
$query = array(
‘v_sortby’ => ‘views’,
‘v_orderby’ => ‘desc’
);
3. Also plugin WP-PostViews by Lester ‘GaMerZ’ Chan should be installed
-
This reply was modified 8 years ago by kazack.
Thread Starter
kazack
(@kazack)
I edit my json-rest-api/lib/class-wp-json-posts.php and get what i want