Skip to content
This repository was archived by the owner on Aug 28, 2021. It is now read-only.

Commit ec6e3d7

Browse files
authored
Merge pull request threesquared#4 from WebSpanner/master
Add postId() function to get posts by id
2 parents 387b30f + a389bce commit ec6e3d7

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ WpApi::post($slug);
5151

5252
```
5353

54+
```php
55+
WpApi::postId($id);
56+
57+
```
58+
5459
#### Categories
5560
```php
5661
WpApi::categories();

src/Threesquared/LaravelWpApi/WpApi.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,17 @@ public function pages($page = null)
6060
return $this->get('posts', ['type' => 'page', 'page' => $page]);
6161
}
6262

63+
/**
64+
* Get post by id
65+
*
66+
* @param int $id
67+
* @return array
68+
*/
69+
public function postId($id)
70+
{
71+
return $this->get("posts/$id");
72+
}
73+
6374
/**
6475
* Get post by slug
6576
*

0 commit comments

Comments
 (0)