✨feature: Add ACF admin field group support with plugin fallback
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
notes/
|
||||
phpcs-results.txt
|
||||
tests/
|
||||
|
||||
Vendored
+9
-1
@@ -3,6 +3,14 @@
|
||||
"tree.indentGuidesStroke": "#3d92ec",
|
||||
"activityBar.background": "#123509",
|
||||
"titleBar.activeBackground": "#1A4A0D",
|
||||
"titleBar.activeForeground": "#F5FDF3"
|
||||
"titleBar.activeForeground": "#F5FDF3",
|
||||
"titleBar.inactiveBackground": "#123509",
|
||||
"titleBar.inactiveForeground": "#F5FDF3",
|
||||
"statusBar.background": "#123509",
|
||||
"statusBar.foreground": "#F5FDF3",
|
||||
"statusBar.debuggingBackground": "#123509",
|
||||
"statusBar.debuggingForeground": "#F5FDF3",
|
||||
"statusBar.noFolderBackground": "#123509",
|
||||
"statusBar.noFolderForeground": "#F5FDF3"
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
* Plugin Name: AA Events
|
||||
* Plugin URI: https://github.com/automattic/aa-events
|
||||
* Description: An Events management plugin for WordPress, with accessible calendar (WCAG 2.2AA) and card grid views.
|
||||
* Version: 1.0.0
|
||||
* Version: 1.1.0
|
||||
* Author: Keith Solomon
|
||||
* Author URI: https://vincentdesign.ca
|
||||
* License: GPL-2.0+
|
||||
|
||||
@@ -9,10 +9,48 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether an ACF field group created in the admin targets the event post type.
|
||||
*
|
||||
* @return bool True if an external field group is assigned to events.
|
||||
*/
|
||||
function events_has_admin_field_group() {
|
||||
if ( ! function_exists( 'acf_get_field_groups' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$groups = acf_get_field_groups( array( 'post_type' => 'event' ) );
|
||||
|
||||
foreach ( $groups as $group ) {
|
||||
if ( isset( $group['active'] ) && ! $group['active'] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
isset( $group['key'], $group['local'] )
|
||||
&& 'group_61b0c5f5a3e7e' === $group['key']
|
||||
&& 'php' === $group['local']
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the ACF field group.
|
||||
*
|
||||
* Skips registration when an admin-created field group is already
|
||||
* assigned to the event post type, allowing full editorial control.
|
||||
*/
|
||||
function events_register_acf_fields() {
|
||||
if ( events_has_admin_field_group() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( function_exists( 'acf_add_local_field_group' ) ) :
|
||||
|
||||
acf_add_local_field_group(
|
||||
|
||||
Reference in New Issue
Block a user