Provides additional endpoints for the WordPress REST API. Originally intended to be used with a Single Page Application, but can be used in any way you like.
GET rest-spa/v1/posts
GET rest-spa/v1/posts/<slug> - the post slug
GET rest-spa/v1/posts/featured
GET rest-spa/v1/posts/recent
GET rest-spa/v1/menu
GET rest-spa/v1/page/<slug> - the page slug
- category - the category slug [OPTIONAL]
- exclude - post ID(s) to exclude, CSV format [OPTIONAL]
- e.g. ?exclude=1,2,3,4,5
- page - Current page [OPTIONAL]
- rest-spa supports simple pagination but note that your page number can exceed the post count and an empty result set will be returned.
- count - number of posts to retrieve, overrides plugin settings [OPTIONAL]
- category - the category slug [OPTIONAL]
- category - the category slug [OPTIONAL]
- count - number of posts to retrieve, overrides plugin settings [OPTIONAL]
- id - the menu ID to retrieve URLs for. [REQUIRED]
- Menu ID can be retrieved by going to Appearance -> Menus -> Hover over "Delete Menu" and look for menu=? in the URL
- force-post - Some themes allow for a page for each category and show the posts on that page; this provides for that scenario and allows you to fetch the posts associated with a given category, based on a page slug
There is a settings page under the Admin Menu item "rest-spa". The following options are available:
- Posts per page
- Recent posts count
- you can enter
-1
to retrieve ALL posts (not recommended)
Note: I'll be updating this repo until it's where I want it to be, so if there haven't been any commits for more than a couple of months, you can assume that it's where I want it to be.