gfic_height
Description
This PHP filter can be used to programmatically set the image display height of Image Choices.
Usage
Applies to all fields.
// for all screen sizes unless overriden for medium and/or small screens
// in those cases, this becomes the size for large screens
add_filter( 'gfic_height', 'set_image_choices_height', 10, 4 );
// for medium screen sizes
add_filter( 'gfic_height_medium', 'set_image_choices_medium_height', 10, 4 );
// for small screen sizes
add_filter( 'gfic_height_small', 'set_image_choices_small_height', 10, 4 );
Applies to all fields in a specific form. In this case, form id 5.
add_filter( 'gfic_height_5', 'set_image_choices_height', 10, 4 );
Applies to specific field and form. In this case, field id 3 in form id 5.
add_filter( 'gfic_height_5_3', 'set_image_choices_height', 10, 4 );
Examples
This example sets custom heights for all Image Choices which vary for medium and small screens:
add_filter( 'gfic_height', 'set_image_choices_height', 10, 4 );
function set_image_choices_height($value, $form_id, $field_id, $default_value) {
return 300;
}
add_filter( 'gfic_height_medium', 'set_image_choices_medium_height', 10, 4 );
function set_image_choices_medium_height($value, $form_id, $field_id, $default_value) {
return 240;
}
add_filter( 'gfic_height_small', 'set_image_choices_small_height', 10, 4 );
function set_image_choices_small_height($value, $form_id, $field_id, $default_value) {
return 170;
}
Screen Size Breakpoints
Below are all the breakpoints for the screen sizes:
large
1080px and abovemedium
480px – 1079pxsmall
Below 480px
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