This document is intended for developers.  Please refer to documentation in the Groundplan plugin for further information.


Groundplan Pro can be further customized by removing standard Groundplan fields that are not necessary for a particular installation.


Remove Standard Groundplan Fields

To remove standard Groundplan fields, insert the following function in your theme's functions.php:




/*-----------------------------------------------------------------------------------*/
// Deregister ACF Fields
/*-----------------------------------------------------------------------------------*/
 
function xdgp_remove_local_fields() {
    if (function_exists('acf_remove_local_field')) {
        $keys_to_remove array(
            // Field key string, e.g. 'field_xdgp_schedule',
            // 'other_field_keys_to_remove',
        );
        foreach ($keys_to_remove as $key) {
            acf_remove_local_field($key);
        }
    }
}
 
 
add_action('acf/init''xdgp_remove_local_fields', 9999);




Remove Standard Groundplan Field Groups

To remove an entire field group, insert the following function in your theme's functions.php:




/*-----------------------------------------------------------------------------------*/
// Deregister ACF Field Groups
/*-----------------------------------------------------------------------------------*/
 
function xdgp_unregister_field_groups($field_groups) {
  foreach($field_groups as $key => $field_group) {
 
    // Remove the Event Images / Calendar Image Field Group
    if ($field_group['key'] == 'group_xdgp_event_images') {
      unset($field_groups[$key]);
    }
  }
  return $field_groups;
}
 
add_action('acf/get_field_groups''xdgp_unregister_field_groups', 9999, 1);



Add an additional field to a Groundplan Field meta box

To remove an additional field to an existing Groundplan meta box such as Event Details, insert the following function in your theme's functions.php:




/*-----------------------------------------------------------------------------------*/
// Register ACF Field in existing Groups
/*-----------------------------------------------------------------------------------*/
 
if( function_exists('acf_add_local_field') ) {
  acf_add_local_field(array(
    'key' => 'field_xdgp_testimonial_heading',
    'label' => 'Testimonial Heading',
    'name' => 'testimonial_heading',
    'type' => 'text',
    'parent' => 'group_component_testimonials'
  ));
}




Modify Image Sizes

To modify default image size values in Groundplan to fit your theme's dimensions:




/*-----------------------------------------------------------------------------------*/
// Modify Event Cover Image Size
/*-----------------------------------------------------------------------------------*/
 
 
function xdgp_cover_image_dimensions( $field ) {
 
  // xdgp_console_debug($field,'fields');
 
  $field['instructions'] = 'Upload a 1920 x 1080 image';
  $field['min_height'] = 1080;
  $field['min_width'] = 1920;
 
  return $field;
 
}
 
add_filter('acf/load_field/key=field_xdgp_event_cover_image''xdgp_cover_image_dimensions');



Complete API for the ACF load_field filter is located in the ACF documentation.



Modify Event Instance Types

To add or remove options from the Event Instance :: Type field, adapt the following example code snippet.




function xdgp_modify_event_instances($args) {
  // Add "Subscribers Only" to list of Event Types
  $args['fields']['eventtype']['values'][] = 'Subscribers Only';
 
  return $args;
}
 
add_action('xdgp_event_instance_arguments''xdgp_modify_event_instances', 10, 1 );