gform_default_choice_alignment

Description

Allows the default choice alignment to be set for fields that support choice alignment.

Usage

add_filter( 'gform_default_choice_alignment', 'your_function_name', 10, 2);

Parameters

  • $default_choice_alignment string
    Default is vertical.
  • $form_id integer
    The ID of the current form.

Examples

Set the choice alignment to Horizontal.

add_filter( 'gform_default_choice_alignment', 'make_choices_horizontal', 10, 2 );
function make_choices_horizontal( $default, $form ) {
	return 'horizontal';
}

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Since

This filter was added in Gravity Forms 2.9.

Source Code

This filter is located in includes/fields/gf-field-choice.php