digitalunited / wp-base
Utiltiy for revisioning of acf and cpt-ui configurations and some other awesomeness
Installs: 426
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 7
Forks: 0
Open Issues: 1
Type:wordpress-plugin
Requires
- php: >=5.3.2
- composer/installers: ~1.0
- monolog/monolog: 1.*
- mustache/mustache: 2.*
Requires (Dev)
- phpunit/phpunit: 4.*
README
Digital United uses this plugin to gain a standard approach to WordPress development with Advanced Custom (ACF) and Custom Post UI (CPT-UI). We don't think these configurations belongs to a database storage but the tools used is great! This plugin offers a way to store, version control and synchronize these settings generated via ACF and CPT-UI.
Status
This WordPress plugin is in experimental phase.
How to get started
This plugin has no user interface.
- The plugin should be installed in the standard plugins folder. Don't activate, yet!
- Run composer in the plugin root, ´composer install´. We will provide a distributed version later on.
- Make sure you have defined WP_DEBUG in wp_config.php, define('WP_DEBUG', true);
- Create a writable folder in your theme named 'wp-base-config', eg /wp-content/themes/your-theme/wp-base-config.
- Activate the plugin!
- Update your ACF or CPT-UI and take a look in the wp-base-config folder.
Advanced Custom Fields
When updating ACF, two files per group will be created/updated.
{key}.json
with the group data for backup as import file.{key}.php
as possible include to test and production environment.
Now it's possible for your team to version control the ACF definitions.
Custom Post Type UI
When updating CPT UI, two files per type will be created/updated.
type_{cpt_name}.php
as register post typetype_{cpt_name}.json
as the data file for the cpt
...or if updating a taxonomy:
taxonomy_{cpt_name}.php
as register taxonomy typetaxonomy_{cpt_name}.json
as the data file for the cpt-taxonomy
Now it's possible for your team to version control the CPT definitions.
Corcel
There are some experimental tests around Corcel that creates models for every CPT. (more info later on)
Custom configuration
Make your custom settings to the plugins configuration via definitions in the project code.
Example: I would like the plugin to generate the code in a different folder/location.
Place a define within the project, eg:
define( 'WPBASE_CONFIGURATION_FOLDER_PATH', dirname(__FILE__) . '/structure/wpbase' );
Bootstrap
If you like to autoload your settings (Acf AND Cpt) in test/stage/production environments and don´t want to activate WP-Base as plugin then you need to create a bootstrap loading. Here is an example to place in your functions file:
$production_server_names = array( 'test.company.com', 'stage.company.com', 'www.company.com' ); if ( in_array( $_SERVER['SERVER_NAME'], $production_server_names ) ) { $files = glob( __DIR__ . '/.wpbase/**/*.php' ); foreach ($files as $file) { include $file; } }
In that way all the necessary files are loaded for the Acf and Cpt.
Other
Fork and contribute via pull requests to make your improvements!
Good luck! Please, leave your feedback!
Troubleshooting
No files generated, please take a look at the defined path/folder permissions!
Contact
Developer: Digital United, Care Of Haus