Skip to content

About

QUILL Site Types: post types, taxonomies and accessible field groups for WordPress, over REST

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QUILL Site Types

A small WordPress plugin for making your own post types, taxonomies and custom fields without writing PHP, and without being locked in.

WordPress has no REST route that creates a post type, a taxonomy or a custom field: each is registered by code that runs on every page load. This plugin keeps the definitions as data, registers them on init with show_in_rest, and gives any REST client, such as the QUILL WordPress Workbench's Content Model, routes to define them.

What it does

  • Post types: name, labels, slug, hierarchical, supports, archive, menu position, icon and taxonomies.
  • Taxonomies: name, labels, hierarchical, and the types they apply to.
  • Field groups: the post types, taxonomies, users or comments they attach to, and their fields, each with a kind, a label, help, required, a default and choices.
  • Field kinds: text, long text, rich text, number, money, date, time, date and time, true or false, choice, several choices, email, address, phone, link, colour, picture, file, gallery, related item, related term, related user, repeater, group and location, and four accessible kinds: a transcript for audio, captions for video, a long description for a picture, and language-marked text. A picture must have alt text, an email must be an email, and a REST save that breaks a field's check is refused with the field named.
  • Your own kinds: POST /kinds with a schema, a label and a pattern to check against, with no new release of anything.
  • Export as Code: GET /export?format=php writes the register_* calls as a PHP file for your theme or a plugin of your own; format=json writes the definitions as data. Deactivate this plugin afterwards and your types and fields stay, with the same slugs and keys.

The routes

All under quill-site-types/v1, and all need manage_options (the Administrator role). Filling the fields in follows each type's own capabilities, through WordPress's own routes (wp/v2/<type> with meta).

Route Methods Does
/kinds GET, POST List the field kinds; add one of your own
/types GET, POST List the post types defined here; define one
/types/<slug> GET, POST, PUT, PATCH, DELETE Read, change or stop defining one
/taxonomies and /taxonomies/<slug> as above The same for taxonomies
/field-groups and /field-groups/<id> as above The same for field groups
/export GET Export as Code: format=php or format=json
/check POST The problems with some values, before saving them

Deleting a definition stops registering it; posts, terms and values already saved stay in the database, and defining it again brings them back.

Tests

php tests/run.php runs the tests with a small stand-in for WordPress, no install needed. They have not yet been run inside a real WordPress.

Licence

MIT. See LICENSE.

About

QUILL Site Types: post types, taxonomies and accessible field groups for WordPress, over REST

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages