Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Retrieve restaurants.
- */
- public function get_items( $request ) {
- $args = array(
- 'post_type' => $this->post_type,
- 'posts_per_page' => $request['per_page'],
- 'page' => $request['page'],
- );
- $restaurants = get_posts( $args );
- $data = array();
- if ( $restaurants ) {
- foreach ( $restaurants as $restaurant ) :
- $itemdata = $this->prepare_item_for_response( $restaurant, $request );
- $data[] = $this->prepare_response_for_collection( $itemdata );
- endforeach;
- }
- $data = rest_ensure_response( $data );
- return $data;
- }
Add Comment
Please, Sign In to add comment