Skip to content

Instantly share code, notes, and snippets.

@pudgereyem
Last active January 1, 2016 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pudgereyem/8144555 to your computer and use it in GitHub Desktop.
Save pudgereyem/8144555 to your computer and use it in GitHub Desktop.
PHP, WORDPRESS: Database setup for Advanced Custom Fields when having a "development" and a "production" environment.
<?php
/*
* Database setup for Advanced Custom Fields
*
* @description: Database setup for Advanced Custom Fields when having a
* "development" and a "production" environment.
* @created: 2013-12-27
*/
/*
* 1. Define Environment variable on the site that is used for development.
* You could define this in wp-config.php.
*/
define('ENV_DEVELOPMENT', true);
/*
* 2. Export the custom fields records manually to a new file located in
* `/library/acf-setup.php`.
* The best case scenario is to automate this, exporting, saving the new records
* as soon as they have been changed. // TODO: Check if this is doable.
* ..for now you have to do it manually.
*/
/* 3. include acf-setup.php if not development.
* Cause in development we want to keep using the Database, so we can use the
* Custom Fields editor to change these records if needed.
*/
if ( !defined('ENV_DEVELOPMENT') ) {
define( 'ACF_LITE', true );
locate_template( '/library/acf-setup.php', true, true );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment