shortlist-digital / wp-tapestry-plugin
WordPress plugin to enable Tapesty - a React frontend for WordPress
Installs: 3 302
Dependents: 4
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Type:wordpress-plugin
Requires
- composer/installers: @stable
- pimple/pimple: 3.2.3
Requires (Dev)
- brain/monkey: 2.2.0
- mockery/mockery: ~1.0
- phpmd/phpmd: 2.*
- phpunit/phpunit: ~5.7.9
- squizlabs/php_codesniffer: 3.*
- wp-coding-standards/wpcs: 0.14.1
This package is not auto-updated.
Last update: 2018-12-07 11:25:47 UTC
README
A WordPress plugin to enable Tapesty - a React frontend for WordPress.
Set up
To get previews over API, plugin requires basic auth plugin enabled and new wordpress user.
Create new user with editor capabilities and add it to environment variables
TAPESTRY_API_USER_PASS='user_pass'
TAPESTRY_API_USER_LOGIN='user_login'
You will also have to set up TAPESTRY_PREVIEW_SALT
with random generated salt and make sure WEB_BASE_DOMAIN, WEB_BASE_PROTOCOL, and WEB_BASE_URL exist
Functionalities
Caching
To clear the Tapestry cache on saved posts this plugin calls a purge url when every post is saved. By default this url is the post url with /purge
added after the domain. You can change this at any time in the Wordpress settings panel under Settings -> Tapestry.
Permalinks
Plugin changes all the permalinks except of attachment url to destination domain specified in env. variable CANONICAL_DOMAIN It also makes drafts unpublished etc. to keep normal link structure
Preview link
Plugin adds id of post and unique hash of post to enable preview. If this attributes are passed to WP Rest API it will return preview of the post instead of post itself.
WP Rest API
Plugin adds new endpoint to default api in namespace revision/v1
which enables you to get revision without authorization
/wp-json/revision/v1/{post_type}/{post_id}?tapestry_hash={tapestry_hash}&p={post_id}
will replace default post with it's revision
you can get preview_hash_and_id from wordpress admin.