add function exists check in custom-comments.php
This commit is contained in:
parent
832fc4b8a0
commit
d180bcfa40
|
@ -15,25 +15,29 @@ add_filter( 'comment_form_default_fields', 'understrap_bootstrap_comment_form_fi
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function understrap_bootstrap_comment_form_fields( $fields ) {
|
|
||||||
$commenter = wp_get_current_commenter();
|
|
||||||
$req = get_option( 'require_name_email' );
|
|
||||||
$aria_req = ( $req ? " aria-required='true'" : '' );
|
|
||||||
$html5 = current_theme_supports( 'html5', 'comment-form' ) ? 1 : 0;
|
|
||||||
$fields = array(
|
|
||||||
'author' => '<div class="form-group comment-form-author"><label for="author">' . __( 'Name',
|
|
||||||
'understrap' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
|
|
||||||
'<input class="form-control" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . '></div>',
|
|
||||||
'email' => '<div class="form-group comment-form-email"><label for="email">' . __( 'Email',
|
|
||||||
'understrap' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
|
|
||||||
'<input class="form-control" id="email" name="email" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . '></div>',
|
|
||||||
'url' => '<div class="form-group comment-form-url"><label for="url">' . __( 'Website',
|
|
||||||
'understrap' ) . '</label> ' .
|
|
||||||
'<input class="form-control" id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30"></div>',
|
|
||||||
);
|
|
||||||
|
|
||||||
return $fields;
|
if ( ! function_exists( 'understrap_bootstrap_comment_form_fields' ) ) {
|
||||||
}
|
|
||||||
|
function understrap_bootstrap_comment_form_fields( $fields ) {
|
||||||
|
$commenter = wp_get_current_commenter();
|
||||||
|
$req = get_option( 'require_name_email' );
|
||||||
|
$aria_req = ( $req ? " aria-required='true'" : '' );
|
||||||
|
$html5 = current_theme_supports( 'html5', 'comment-form' ) ? 1 : 0;
|
||||||
|
$fields = array(
|
||||||
|
'author' => '<div class="form-group comment-form-author"><label for="author">' . __( 'Name',
|
||||||
|
'understrap' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
|
||||||
|
'<input class="form-control" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . '></div>',
|
||||||
|
'email' => '<div class="form-group comment-form-email"><label for="email">' . __( 'Email',
|
||||||
|
'understrap' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
|
||||||
|
'<input class="form-control" id="email" name="email" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . '></div>',
|
||||||
|
'url' => '<div class="form-group comment-form-url"><label for="url">' . __( 'Website',
|
||||||
|
'understrap' ) . '</label> ' .
|
||||||
|
'<input class="form-control" id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30"></div>',
|
||||||
|
);
|
||||||
|
|
||||||
|
return $fields;
|
||||||
|
}
|
||||||
|
} // endif function_exists( 'understrap_bootstrap_comment_form_fields' )
|
||||||
|
|
||||||
add_filter( 'comment_form_defaults', 'understrap_bootstrap_comment_form' );
|
add_filter( 'comment_form_defaults', 'understrap_bootstrap_comment_form' );
|
||||||
|
|
||||||
|
@ -44,11 +48,15 @@ add_filter( 'comment_form_defaults', 'understrap_bootstrap_comment_form' );
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function understrap_bootstrap_comment_form( $args ) {
|
|
||||||
$args['comment_field'] = '<div class="form-group comment-form-comment">
|
if ( ! function_exists( 'understrap_bootstrap_comment_form' ) ) {
|
||||||
<label for="comment">' . _x( 'Comment', 'noun', 'understrap' ) . ( ' <span class="required">*</span>' ) . '</label>
|
|
||||||
<textarea class="form-control" id="comment" name="comment" aria-required="true" cols="45" rows="8"></textarea>
|
function understrap_bootstrap_comment_form( $args ) {
|
||||||
</div>';
|
$args['comment_field'] = '<div class="form-group comment-form-comment">
|
||||||
$args['class_submit'] = 'btn btn-secondary'; // since WP 4.1.
|
<label for="comment">' . _x( 'Comment', 'noun', 'understrap' ) . ( ' <span class="required">*</span>' ) . '</label>
|
||||||
return $args;
|
<textarea class="form-control" id="comment" name="comment" aria-required="true" cols="45" rows="8"></textarea>
|
||||||
}
|
</div>';
|
||||||
|
$args['class_submit'] = 'btn btn-secondary'; // since WP 4.1.
|
||||||
|
return $args;
|
||||||
|
}
|
||||||
|
} // endif function_exists( 'understrap_bootstrap_comment_form' )
|
||||||
|
|
Reference in New Issue