Merge pull request #4 from WebSpanner/master
Add postId() function to get posts by id
This commit is contained in:
commit
ec6e3d7263
|
|
@ -51,6 +51,11 @@ WpApi::post($slug);
|
|||
|
||||
```
|
||||
|
||||
```php
|
||||
WpApi::postId($id);
|
||||
|
||||
```
|
||||
|
||||
#### Categories
|
||||
```php
|
||||
WpApi::categories();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue