Skip to content

gfic_feature_color_custom

Description

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

Usage

Applies to all fields.

add_filter( 'gfic_feature_color_custom', 'set_image_choices_custom_feature_color', 10, 4 );

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

add_filter( 'gfic_feature_color_custom_5', 'set_image_choices_custom_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_custom_5_3', 'set_image_choices_custom_feature_color', 10, 4 );

Parameters

  • $value string
    The current custom color value. This should be a valid hex value including the hash (eg “#000000”)
  • $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 custom feature color to a dark orange for all fields:

add_filter( 'gfic_feature_color_custom', 'set_image_choices_custom_feature_color', 10, 4 );
function set_image_choices_custom_feature_color($value, $form_id, $field_id, $default_value) {
    return "#924730";
}

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