| | |
| | | public function getNews(WP_REST_Request $request):WP_REST_Response |
| | | { |
| | | $args = $this->buildQueryArgs($request); |
| | | $key = $this->cache->generateKey($args); |
| | | $cache = $this->cache->get($key); |
| | | |
| | | $cache = $this->cache->get($args); |
| | | if ($cache) { |
| | | return $this->success($cache); |
| | | } |
| | |
| | | 'total_pages' => $query->max_num_pages |
| | | ]; |
| | | |
| | | $this->cache->set($key, $results); |
| | | $this->cache->set($args, $results); |
| | | |
| | | return $this->success($results); |
| | | } |
| | |
| | | $artist = jvbContentFromUser($post->post_author); |
| | | $upvotes = (int) get_post_meta($post->ID, BASE.'upvotes', true); |
| | | $downvotes = (int) get_post_meta($post->ID, BASE.'downvotes', true); |
| | | $comments = JVB()->routes('comments')->getItemResponse($post->ID, BASE.'news'); |
| | | $comments = ResponseRoutes::getInstance()->getItemResponse($post->ID, ['post_type' => BASE.'news']); |
| | | |
| | | return [ |
| | | 'id' => $post->ID, |