Forked from vovadocent/readonly_and_disabled_to_text_acf.php
Created
July 24, 2024 18:14
-
-
Save dgoze/aa6ca10587a440fd278ba852e7e7e604 to your computer and use it in GitHub Desktop.
Readonly and disabled to ACF text field
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('acf/render_field_settings/type=text', 'add_readonly_and_disabled_to_text_field'); | |
function add_readonly_and_disabled_to_text_field($field) { | |
acf_render_field_setting( $field, array( | |
'label' => __('Read Only?','acf'), | |
'instructions' => '', | |
'type' => 'radio', | |
'name' => 'readonly', | |
'choices' => array( | |
1 => __("Yes",'acf'), | |
0 => __("No",'acf'), | |
), | |
'value' => 0, | |
'layout' => 'horizontal', | |
)); | |
acf_render_field_setting( $field, array( | |
'label' => __('Disabled?','acf'), | |
'instructions' => '', | |
'type' => 'radio', | |
'name' => 'disabled', | |
'choices' => array( | |
1 => __("Yes",'acf'), | |
0 => __("No",'acf'), | |
), | |
'value' => 0, | |
'layout' => 'horizontal', | |
)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment