- This topic has 10 replies, 2 voices, and was last updated 3 years, 2 months ago by
Fernando.
-
AuthorPosts
-
February 13, 2023 at 8:26 pm #2532341
Srini
Hi
When I click Tab in the form fileds, cursor jumping to email from name field by skipping the phone number filed.
Can you guide me to fix this issue?Please check the link attached.
February 13, 2023 at 8:48 pm #2532352Fernando Customer Support
Hi Srini,
It’s not skipping the Phone Number field from my end when I try tabbing.
Can you try using a different device to test?
February 13, 2023 at 9:29 pm #2532376Srini
Hi Fernando,
Please check below video.
February 13, 2023 at 10:03 pm #2532388Srini
Hi Fernando,
Please check below video.
February 13, 2023 at 10:12 pm #2532395Fernando Customer Support
I see. May we know how you specifically added the Phone Number field?
February 13, 2023 at 10:41 pm #2532408Srini
Yes, added additional filed
February 13, 2023 at 10:50 pm #2532419Fernando Customer Support
Can you specify how you added it? What steps did you take for that field to appear?
February 13, 2023 at 11:35 pm #2532442Srini
I have edited the commnet.php file and included additional field
$fields[‘author’] = sprintf(
‘<label for=”author” class=”screen-reader-text”>%1$s</label><input placeholder=”Name *” id=”author” name=”author” type=”text” value=”%2$s” size=”30″%4$s />’,
esc_html__( ‘Name’, ‘generatepress’ ),
esc_attr( $commenter[‘comment_author’] ),
$required ? ‘ *’ : ”,
$required ? ‘ required’ : ”
);$fields[‘phone’] = sprintf(
‘<input placeholder=”%1$s%3$s *” id=”phone” name=”phone” type=”text” value=”%2$s” size=”30″%4$s />’,
esc_html__( ‘Phone’, ‘generatepress’ ),
esc_attr( $commenter[‘comment_author_phone’] ),
$required ? ‘ ‘ : ”,
$required ? ‘ required’ : ”
);$fields[’email’] = sprintf(
‘<label for=”email” class=”screen-reader-text”>%1$s</label><input placeholder=”%1$s%3$s” id=”email” name=”email” type=”email” value=”%2$s” size=”30″%4$s />’,
esc_html__( ‘Email’, ‘generatepress’ ),
esc_attr( $commenter[‘comment_author_email’] ),
$required ? ‘ ‘ : ”,
$required ? ‘ required’ : ”
);February 13, 2023 at 11:56 pm #2532461Fernando Customer Support
Does that work? Do you get the Phone number when someone comments? If not, it may be good to use a plugin for this. Example: https://www.wpbeginner.com/plugins/how-to-add-custom-fields-to-comments-form-in-wordpress/
February 14, 2023 at 12:06 am #2532474Srini
Yes, I have saved phone no using below function
add_action( ‘comment_post’, ‘save_comment_author_phone’ );
function save_comment_author_phone( $comment_id ){
if( isset( $_POST[‘phone’] ) )
update_comment_meta( $comment_id, ‘phone’, esc_attr( $_POST[‘phone’] ) );
}
function print_author_phone( $id ) {
$val = get_comment_meta( $id, “phone”, true );
$title = $val ? ‘<strong class=”author_phone”>’ . $val . ‘‘ : ”;
return $title;
}add_filter(‘manage_edit-comments_columns’, ‘my_add_comments_columns’);
February 14, 2023 at 12:23 am #2532484Fernando Customer Support
This is actually out of our scope of support as it’s more related to WordPress and not the Theme itself.
However, can you try adding a Snippet like this?:
add_filter( 'comment_form_fields', 'mo_comment_fields_custom_order' ); function mo_comment_fields_custom_order( $fields ) { $comment_field = $fields['comment']; $author_field = $fields['author']; $email_field = $fields['email']; $url_field = $fields['url']; $cookies_field = $fields['cookies']; $phone_field = $fields['phone']; unset( $fields['comment'] ); unset( $fields['author'] ); unset( $fields['email'] ); unset( $fields['url'] ); unset( $fields['cookies'] ); unset( $fields['phone'] ); // the order of fields is the order below, change it as needed: $fields['comment'] = $comment_field; $fields['author'] = $author_field; $fields['phone'] = $phone_field; $fields['email'] = $email_field; $fields['url'] = $url_field; $fields['cookies'] = $cookies_field; // done ordering, now return the fields: return $fields; }Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets
-
AuthorPosts
- You must be logged in to reply to this topic.