Add constant to enable ACF on frontend

This commit is contained in:
Tetrakern 2023-08-15 12:29:17 +02:00
parent 9d08978028
commit 5db2295cac
3 changed files with 7 additions and 1 deletions

View File

@ -787,3 +787,4 @@ define( 'CONSTANT_NAME', value );
| FICTIONEER_DISABLE_ACF_JSON_IMPORT | boolean | Whether to disable the ACF JSON field import. Dangerous. Default `false`.
| FICTIONEER_ENABLE_STICKY_CARDS | boolean | Whether to allow sticky cards. Expensive. Default `true`.
| FICTIONEER_ENABLE_STORY_DATA_META_CACHE | boolean | Whether to "cache" story data in a meta field. Default `true`.
| FICTIONEER_ENABLE_FRONTEND_ACF | boolean | Whether to load ACF on the frontend. Default `false`.

View File

@ -304,6 +304,11 @@ if ( ! defined( 'FICTIONEER_ENABLE_STORY_DATA_META_CACHE' ) ) {
define( 'FICTIONEER_ENABLE_STORY_DATA_META_CACHE', true );
}
// Boolean: Enable ACF on frontend
if ( ! defined( 'FICTIONEER_ENABLE_FRONTEND_ACF' ) ) {
define( 'FICTIONEER_ENABLE_FRONTEND_ACF', false );
}
// =============================================================================
// GLOBAL
// =============================================================================

View File

@ -48,7 +48,7 @@ function fictioneer_acf_json_save_point( $path ) {
// LOAD ACF PLUGIN FROM THEME IF NOT INSTALLED (ADMIN ONLY)
// =============================================================================
if ( ! class_exists('acf') && is_admin() ) {
if ( ! class_exists('acf') && ( is_admin() || FICTIONEER_ENABLE_FRONTEND_ACF ) ) {
// Define path and URL to the ACF plugin.
define( 'FICTIONEER_ACF_PATH', get_template_directory() . '/includes/acf/' );
define( 'FICTIONEER_ACF_URL', get_template_directory_uri() . '/includes/acf/' );