Carawebs Custom Content Types
WordPress plugin that registers custom post types and taxonomies from a PHP config array.
by David Egan · github.com/carawebs/wp-custom-content · website
★ 1stars
34composer installs
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/carawebs/wp-custom-content/archive/refs/heads/master.zipAlso on Packagist as carawebs/wp-custom-content:
composer require carawebs/wp-custom-contentFrom the readme
WP CPT
A WordPress plugin which registers:
- Custom post types
- Custom taxonomies
If you want to use this as a Composer package, rather than as a WordPress plugin, use the dev-library branch:
~~~js
// composer.json for project
"carawebs/wp-custom-content": "dev-library"
~~~
I don't recommend this - the dev-library is a bit of an experiment in de-coupling custom post type registration from themes and plugins and is probably a step too far. CPT registration is probably best managed in either a plugin or mu-plugin). That branch does have quite an interesting method of loading, and a fluent interface to set the config file location.
Usage
This plugin is designed for use with Bedrock. Bedrock has an improved project structure compared to regular WordPress installations.
The plugin is intended as an aid for developers - there is no settings GUI.
Instead, a configuration file which returns a PHP array is used to register custom post types and taxonomies. This means you can easily define custom post types and taxonomies for your project by simply amending an array.
Config Files
Sample config files are provided in the /sample-config directory.
By default, the plugin looks for confi