Skip to content

gfic_feature_color

Description

This PHP filter can be used to programmatically set the feature color setting on Image Choices fields

Usage

Applies to all fields.

add_filter( 'gfic_feature_color', 'set_image_choices_feature_color', 10, 4 );

Applies to all fields in a specific form. In this case, form id 5.

add_filter( 'gfic_feature_color_5', 'set_image_choices_feature_color', 10, 4 );

Applies to specific field and form. In this case, field id 3 in form id 5.

add_filter( 'gfic_feature_color_5_3', 'set_image_choices_feature_color', 10, 4 );

Parameters

  • $value string
    The current feature color setting. Can be either “form_setting” or “custom”.
    When set the “custom” you can use the gfic_feature_color_custom filter to define the actual color
  • $form_id integer
    The current form id.
  • $field_id integer
    The current field id.
  • $default_value string
    The plugin’s default value for this option.

Examples

This example sets the Image Choices feature color to custom for all fields:

add_filter( 'gfic_feature_color', 'set_image_choices_feature_color', 10, 4 );
function set_image_choices_feature_color($value, $form_id, $field_id, $default_value) {
    return "custom";
}

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

This filter is located in the get_field_settings_value function in class-gf-image-choices.php