diff --git a/README.md b/README.md index ae11266..893932f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## WordPress Backend -Before you install WordPress, make sure you have all the required software installed for your operating system. +The wordpress folder contains the plugin dependencies and the Saburly Headless theme. You can add them to your existing development environment. Or if you want to install WordPress and a full dev environment, you can use the scripts from this repository. In that case, make sure you have all the required software installed for your operating system. ### Prerequisites @@ -22,3 +22,11 @@ When the installation process completes successfully: * The WordPress GraphQL API is available at [http://localhost:8080/graphql](http://localhost:8080/graphql) * The WordPress admin is at [http://localhost:8080/wp-admin/](http://localhost:8080/wp-admin/) + +### Manual install + +You can replace the wordpress folder + +### Frontend + +The contains frontend is stored in a separate repository in Gitlab. \ No newline at end of file diff --git a/wordpress/wp-content/themes/saburly-headless/acf-json/index.php b/wordpress/wp-content/themes/saburly-headless/acf-json/index.php new file mode 100644 index 0000000..e6738f5 --- /dev/null +++ b/wordpress/wp-content/themes/saburly-headless/acf-json/index.php @@ -0,0 +1,4 @@ + 'Headless Settings', + 'menu_title' => 'Headless', + 'menu_slug' => 'headless-settings', + 'capability' => 'manage_options', + 'post_id' => 'headless-settings', + 'redirect' => false, + ] ); +} diff --git a/wordpress/wp-content/themes/saburly-headless/inc/class-acf-commands.php b/wordpress/wp-content/themes/saburly-headless/inc/class-acf-commands.php new file mode 100644 index 0000000..ea75aae --- /dev/null +++ b/wordpress/wp-content/themes/saburly-headless/inc/class-acf-commands.php @@ -0,0 +1,77 @@ + get_post_modified_time( 'U', true, $group['ID'], true ) ) { + $sync[ $group['key'] ] = $group; + } + } + + // bail if no sync needed + if ( empty( $sync ) ) { + WP_CLI::success( 'No ACF Sync Required' ); + return; + } + + if ( ! empty( $sync ) ) { + acf_update_setting( 'json', false ); + + // vars + $new_ids = []; + + foreach ( $sync as $key => $v ) { + // append fields + if ( acf_have_local_fields( $key ) ) { + $sync[ $key ]['fields'] = acf_get_local_fields( $key ); + } + // import + $field_group = acf_import_field_group( $sync[ $key ] ); + } + } + + WP_CLI::success( 'ACF SYNC SUCCESS!' ); + } + } + WP_CLI::add_command( 'acf', 'ACF_Commands' ); +}