From f7871a93468e5c1b8d7a16aa6e4dc331b1c3741a Mon Sep 17 00:00:00 2001 From: Rob Record Date: Fri, 13 Oct 2017 13:20:47 +0100 Subject: [PATCH 1/2] Allowed sync data to reside within child themes --- cptuisync.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cptuisync.php b/cptuisync.php index 5c5b5e2..5a2e6c3 100644 --- a/cptuisync.php +++ b/cptuisync.php @@ -65,7 +65,7 @@ function cptuisync_taxonomy_path() { * @return string */ function cptuisync_directory() { - $defaultDir = get_template_directory() . '/cptui'; + $defaultDir = get_stylesheet_directory() . '/cptui'; if(!is_dir($defaultDir)) { mkdir($defaultDir, null, true); } From 425493bcfe40bc045bf42d7047bf9772931c99f1 Mon Sep 17 00:00:00 2001 From: Rob Record Date: Fri, 13 Oct 2017 13:31:26 +0100 Subject: [PATCH 2/2] Prevent errors if cptui code not present; improve instructions --- readme.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/readme.txt b/readme.txt index d774ac0..6c1ec26 100644 --- a/readme.txt +++ b/readme.txt @@ -16,13 +16,14 @@ Save Custom Post Type UI (CPT UI) content types to a file so they can be added t When you update or save a custom post type or taxonomy in CPT UI, the export code will be automatically dumped into your theme in the `cptui` folder. -All you have to do is include those files (`cptui/post_types.php` and `cptui/taxonomies.php`) in your theme and all your post types and taxonomies will work in your different environments without having to install CPT UI on live or staging. +All you have to do is include those files (`cptui/post_types.php` and `cptui/taxonomies.php`) in your theme using the code below and all your post types and taxonomies will work in your different environments without having to install CPT UI on live or staging. +In functions.php, add: ` -// only load if cptui not intialised -if(!function_exists('cptui_init')) { - require 'cptui/post_types.php'; - require 'cptui/taxonomies.php'; +// only load if Custom Post Type UI plugin is not intialised +if( !function_exists( 'cptui_init' ) ) { + include 'cptui/post_types.php'; + include 'cptui/taxonomies.php'; } `