Change the choice render using a custom PHP output with new available hooks. This feature allow developers to fully customize choices and render the most complex templates.
Field Render
Hook Usage
/**
* acfe/render_choice
*
* @string $input Choice Input HTML tag
* @string $value Choice value
* @string $label Choice label
* @array $field Field array
*/
action('acfe/render_choice', $input, $value, $label, $field);
action('acfe/render_choice/type=radio', $input, $value, $label, $field);
action('acfe/render_choice/name=my_radio', $input, $value, $label, $field);
action('acfe/render_choice/key=field_60c6b1a8e3e6e', $input, $value, $label, $field);
<?php
add_action('acfe/render_choice/name=my_radio', 'my_acfe_render_choice', 10, 4);
function my_acfe_render_choice($input, $value, $label, $field){
?>
<div class="my-choice">
<div>
<strong><?php echo $label; ?></strong>
<div><?php echo $value; ?></div>
</div>
<div>
<?php echo $input; ?>
</div>
</div>
<?php
}
Compatible Fields
The Dynamic Choice Render is compatible with all fields that actually render a checkbox or a radio, which includes dynamic fields such as Block Types, Post Types, Taxonomy Terms etc…
Define grouped choices values using “## Title” markup in the field’s choices.
Setting name | Description |
Choices | You may use “## Title” to create a group of options. |