This will help you connect Ember Data with the official Wordpress API also known as the WP-API. Works fine with Ember Data 2.x and WP API v2. An extremely powerful and easy combination.
This addon works with ember-cli. Once installed, you'll have an application adapter, serializer as well as the default models (post, page, category, tag) that you need for Wordpress out of the box. For an example setup, see the tests/dummy
folder in this repository.
- Install it:
ember install ember-wordpress
- Define your
wordpressHost
inconfig/environment.js
.
Your host is where your Wordpress is running. Example:
var ENV = {
...
wordpressHost: 'http://my-wordpress-install.com'
...
You'll need to install the WP API v2 plugin and possibly WP-CORS. If you see your data at example/com/wp-json/wp/v2 it works.
Advanced Custom Fields and ACF To REST API work really well with this setup.
This addon provides models for post, page, category and tag. If you need to overwrite them, make sure they still extend the default ones provided by this addon. See ember-wordpress/app/models as an example.
It's the goal of ember-wordpress to become the bridge between ember/ember-data and the official WP REST API. Ideally, in adition to the provided serializer and models, the project's dummy app should serve as an example how to work with it.
While this ember addon is fairly untested, the setup isn't. Feel free to ask any questions here https://github.com/oskarrough/ember-wordpress/issues.