gform_default_choice_alignment

Description

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

Usague

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

Parameters

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

Examples

Set the choice alignment to Horizontal.

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

Placement

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

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