API List Pages
List pages allow you to display WP-API driven list content in your app with bonus features like favoriting.
For example, display a list of posts or pages from your WordPress site. You can also display custom post type content, such as books, products, or speakers. This content is stored for offline use after viewing, and is typically faster than an iframe page.
Limitations of List Pages
API lists display read-only post content, they do not work with custom plugins or special content.
For example, an embedded form, slider, or custom gallery plugin will not work through the API. If you have anything other than read-only content such as a blog post, you should use an iframe page instead.
WP-API (v2) plugin
Before you create a list page, you must have a WordPress website running version 4.7 or later. If you are on 4.6 or lower, make sure you have the WP-API plugin installed and activated.
In your WordPress site, go to Plugins => Add New, and search for Rest API. Install and activate this plugin. Make sure the plugin title is: WordPress REST API (Version 2)
You should be able to navigate to mysite.com/wp-json and see data there. If not, the plugin is not installed correctly.
Create a List Page
To create a list page, in the App Customizer go to Custom Pages => Add New.
Choose "list" from the dropdown, and add your title and list route.
All API list pages only show for the app where you created them, so you won't see the page you just created if you go to another app.
Default Featured Image
The small image next to your posts will be pulled from your WordPress featured image. To change this image, upload a file called default.png to your offline assets under the settings tab of the app customizer. Recommended size is 150x150px.
A list route is any API endpoint with collection data, such as posts or pages. Here are a list of example endpoints:
Some endpoints (such as users) require authentication. AppPresser does not have a way to handle authenticated endpoints at this time.
Custom post types and post meta data do not show up in the API by default. View this article for help.
To add custom content to the list item display, you can use template hooks.
Custom Route Parameters
The WP-API allows you to add parameters to your query to show custom results. For example, to show a certain category, you would add this url as your route:
The '40' at the end is the category term ID. You can do the same for tags by changing the parameter to ?tags=XX. How to find the category or tag ID.
There are other parameters available, such as author, orderby, exclude, and more. For a full list, please see the "Arguments" section here. You can string parameters like this:
You would put that full url as the list route in your custom page.