Compare commits
4 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec6e3d7263 | ||
|
|
a389bcea7a | ||
|
|
387b30fffc | ||
|
|
7f2b217bc0 |
15
README.md
15
README.md
|
|
@ -12,11 +12,7 @@ Simply add the following line to your `composer.json` and run install/update:
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Publish the package config files to configure the location of your Wordpress install:
|
You will need to add the service provider and optionally the facade alias to your `config/app.php`:
|
||||||
|
|
||||||
php artisan vendor:publish
|
|
||||||
|
|
||||||
You will also need to add the service provider and optionally the facade alias to your `config/app.php`:
|
|
||||||
|
|
||||||
```php
|
```php
|
||||||
'providers' => array(
|
'providers' => array(
|
||||||
|
|
@ -28,6 +24,10 @@ You will also need to add the service provider and optionally the facade alias t
|
||||||
),
|
),
|
||||||
```
|
```
|
||||||
|
|
||||||
|
And publish the package config files to configure the location of your Wordpress install:
|
||||||
|
|
||||||
|
php artisan vendor:publish
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
The package provides a simplified interface to some of the existing api methods documented [here](http://wp-api.org/).
|
The package provides a simplified interface to some of the existing api methods documented [here](http://wp-api.org/).
|
||||||
|
|
@ -51,6 +51,11 @@ WpApi::post($slug);
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```php
|
||||||
|
WpApi::postId($id);
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
#### Categories
|
#### Categories
|
||||||
```php
|
```php
|
||||||
WpApi::categories();
|
WpApi::categories();
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,17 @@ class WpApi
|
||||||
return $this->get('posts', ['type' => 'page', 'page' => $page]);
|
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
|
* Get post by slug
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue