PlaceHolder Text
-
Hi,
thank you so much for keeping this plugin alive.one suggestion: placeholder text should not be entered as one of the options since it will render the validation useless. Instead you can leave it up to the user that is building the form to manually type it in just in case people want to use a different wording like (‘choose’ instead of ‘select’) or (‘an’ instead of ‘a’) before the taxonomy/CustomPost name.
You can add a if statement to check if there is a placeholder typed in by adding the following lines to the indicated functions in the gfcptaddonbase.php file:
function setup_taxonomy_field
if ($field['placeholder'] == '') { $field['placeholder'] = 'Select a ' . $taxonomy->labels->singular_name; }function setup_post_type_field
if ($field['placeholder'] == '') { $field['placeholder'] = 'Select a ' . $post_type_obj->labels->singular_name; }and remove the following lines from the load_post_type_choices, load_taxonomy_choices functions:
– remove line (258)
$choices[] = array('text' => "-- select a {$post_type_obj->labels->singular_name} --", 'value' => '');– or remove the entire if statement that contains the first choice (lines 255-262)
if ($first_choice === '' || $first_choice === 'First Choice'){ // if no default option is specified, dynamically create based on post type name $post_type_obj = get_post_type_object($post_type); $choices[] = array('text' => "-- select a {$post_type_obj->labels->singular_name} --", 'value' => ''); } else { $choices[] = array('text' => $first_choice, 'value' => ''); }– and remove line (341)
$choices[] = array('text' => "-- select a {$taxonomy->labels->singular_name} --", 'value' => '');– or remove the entire if statement that contains the first choice (lines 338-344)
if ($first_choice === '' || $first_choice === 'First Choice'){ // if no default option is specified, dynamically create based on taxonomy name $taxonomy = get_taxonomy($taxonomy); // $choices[] = array('text' => "-- select a {$taxonomy->labels->singular_name} --", 'value' => ''); } else { $choices[] = array('text' => $first_choice, 'value' => ''); }https://ww.wp.xz.cn/plugins/gravity-forms-custom-post-types/
The topic ‘PlaceHolder Text’ is closed to new replies.