Skip to content

gfic_align

Description

This PHP filter can be used to programmatically set the alignment of Image Choices.

Usage

Applies to all fields.

add_filter( 'gfic_align', 'set_image_choices_alignment', 10, 4 );

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

add_filter( 'gfic_align_5', 'set_image_choices_alignment', 10, 4 );

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

add_filter( 'gfic_align_5_3', 'set_image_choices_alignment', 10, 4 );

Parameters

  • $value string
    The current alignment setting. Defaults to “form_setting”.
  • $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 alignment for all Image Choices fields to “left”:

add_filter( 'gfic_align', 'set_image_choices_alignment', 10, 4 );
function set_image_choices_alignment($value, $form_id, $field_id, $default_value) {
    return "left";
}

Supported Values

Below are all the supported values for the Image Choices alignment setting:

  • form_setting (default)
    Will use the alignment defined in the form settings.
  • theme_default
    Will use alignment that is default for the selected Image Choices theme. Typically this will be “center”
  • left
    Will left align the Image Choices.
  • center
    Will center align the Image Choices.
  • right
    Will right align the Image Choices.

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