Add postId function to get posts by id

This commit is contained in:
Andrew Feeney 2016-12-02 11:07:30 +11:00
parent 387b30fffc
commit a389bcea7a
2 changed files with 16 additions and 0 deletions

View file

@ -51,6 +51,11 @@ WpApi::post($slug);
```
```php
WpApi::postId($id);
```
#### Categories
```php
WpApi::categories();

View file

@ -60,6 +60,17 @@ class WpApi
return $this->get('posts', ['type' => 'page', 'page' => $page]);
}
/**
* Get post by id
*
* @param int $id
* @return array
*/
public function postId($id)
{
return $this->get("posts/$id");
}
/**
* Get post by slug
*