Last active
January 1, 2016 12:29
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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