add function exists check in custom-comments.php

This commit is contained in:
MarieComet 2018-03-05 07:29:00 +01:00
parent 832fc4b8a0
commit d180bcfa40
1 changed files with 34 additions and 26 deletions

View File

@ -15,7 +15,10 @@ add_filter( 'comment_form_default_fields', 'understrap_bootstrap_comment_form_fi
* *
* @return array * @return array
*/ */
function understrap_bootstrap_comment_form_fields( $fields ) {
if ( ! function_exists( 'understrap_bootstrap_comment_form_fields' ) ) {
function understrap_bootstrap_comment_form_fields( $fields ) {
$commenter = wp_get_current_commenter(); $commenter = wp_get_current_commenter();
$req = get_option( 'require_name_email' ); $req = get_option( 'require_name_email' );
$aria_req = ( $req ? " aria-required='true'" : '' ); $aria_req = ( $req ? " aria-required='true'" : '' );
@ -33,7 +36,8 @@ function understrap_bootstrap_comment_form_fields( $fields ) {
); );
return $fields; 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 ) {
if ( ! function_exists( 'understrap_bootstrap_comment_form' ) ) {
function understrap_bootstrap_comment_form( $args ) {
$args['comment_field'] = '<div class="form-group comment-form-comment"> $args['comment_field'] = '<div class="form-group comment-form-comment">
<label for="comment">' . _x( 'Comment', 'noun', 'understrap' ) . ( ' <span class="required">*</span>' ) . '</label> <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> <textarea class="form-control" id="comment" name="comment" aria-required="true" cols="45" rows="8"></textarea>
</div>'; </div>';
$args['class_submit'] = 'btn btn-secondary'; // since WP 4.1. $args['class_submit'] = 'btn btn-secondary'; // since WP 4.1.
return $args; return $args;
} }
} // endif function_exists( 'understrap_bootstrap_comment_form' )