最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

php - WordPress comment submit button substitutesoptions

matteradmin4PV0评论
$args = array(
                'id_form'           => 'commentform',
                'class_form'        => 'comment-form theme-comment-action',
                'id_submit'         => 'submit',
                'class_submit'      => 'submit',
                'name_submit'       => 'submit',
                'submit_button'     => '<a name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s"><i class="fa fa-comment" aria-hidden="true"></i><span> Submit Comment </span></a>',
                'title_reply'       => '',
                'title_reply_to'    => __( 'Reply to %s','text-domain' ),
                'cancel_reply_link' => __( 'Cancel comment','text-domain' ),
                'label_submit'      => __( 'Post comment','text-domain' ),
                'format'            => 'xhtml',
                'comment_field'     =>  '<textarea id="comment" name="comment" placeholder="'.__('Enter Your Comment Here','text-domain').'" cols="45" rows="8" aria-required="true">' .'</textarea>',
                'logged_in_as'      => '<p class="logged-in-as">' .
                                      sprintf(
                                          __( 'Logged in as %1$s. <a href="%2$s" title="%3$s">%4$s</a>', 'text-domain'),
                                          $user_identity,
                                          wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) ),
                                          __('Log out?','text-domain'),
                                          __('Click to log out.','text-domain')
                                      ) . '</p>',
                'comment_notes_before' => '<p class="comment-notes">' . __( 'Your email address will not be published.','text-domain' ) .'</p>',
                'fields'            => apply_filters( 'comment_form_default_fields', $fields ),
            );

            comment_form( $args );

Above is the method how we make changes to some of the fields in the comment system.

One such field is submit Button →

'submit_button'     => '<input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" />',

But my HTML is designed in such a way that this uses an <a></a> tag. Itried to use something like this:

<a name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s"><i class="fa fa-comment" aria-hidden="true"></i><span> Submit Comment </span></a>

But it is doesn't work. Can someone recommend any fix?

$args = array(
                'id_form'           => 'commentform',
                'class_form'        => 'comment-form theme-comment-action',
                'id_submit'         => 'submit',
                'class_submit'      => 'submit',
                'name_submit'       => 'submit',
                'submit_button'     => '<a name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s"><i class="fa fa-comment" aria-hidden="true"></i><span> Submit Comment </span></a>',
                'title_reply'       => '',
                'title_reply_to'    => __( 'Reply to %s','text-domain' ),
                'cancel_reply_link' => __( 'Cancel comment','text-domain' ),
                'label_submit'      => __( 'Post comment','text-domain' ),
                'format'            => 'xhtml',
                'comment_field'     =>  '<textarea id="comment" name="comment" placeholder="'.__('Enter Your Comment Here','text-domain').'" cols="45" rows="8" aria-required="true">' .'</textarea>',
                'logged_in_as'      => '<p class="logged-in-as">' .
                                      sprintf(
                                          __( 'Logged in as %1$s. <a href="%2$s" title="%3$s">%4$s</a>', 'text-domain'),
                                          $user_identity,
                                          wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) ),
                                          __('Log out?','text-domain'),
                                          __('Click to log out.','text-domain')
                                      ) . '</p>',
                'comment_notes_before' => '<p class="comment-notes">' . __( 'Your email address will not be published.','text-domain' ) .'</p>',
                'fields'            => apply_filters( 'comment_form_default_fields', $fields ),
            );

            comment_form( $args );

Above is the method how we make changes to some of the fields in the comment system.

One such field is submit Button →

'submit_button'     => '<input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" />',

But my HTML is designed in such a way that this uses an <a></a> tag. Itried to use something like this:

<a name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s"><i class="fa fa-comment" aria-hidden="true"></i><span> Submit Comment </span></a>

But it is doesn't work. Can someone recommend any fix?

Share Improve this question asked Sep 11, 2017 at 9:54 WordCentWordCent 1,9066 gold badges34 silver badges60 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

The <a> tag is the wrong tag for a submit button. <input type="submit"> and <button> are designed for this purpose. An <a> tag won't even submit the form data. You need to change your HTML to accommodate this fact.

Post a comment

comment list (0)

  1. No comments so far