From d180bcfa408bd979d204ffcbb666b78264a4ceda Mon Sep 17 00:00:00 2001 From: MarieComet Date: Mon, 5 Mar 2018 07:29:00 +0100 Subject: [PATCH] add function exists check in custom-comments.php --- inc/custom-comments.php | 60 +++++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/inc/custom-comments.php b/inc/custom-comments.php index 429b3f1..ea5d0cd 100644 --- a/inc/custom-comments.php +++ b/inc/custom-comments.php @@ -15,25 +15,29 @@ add_filter( 'comment_form_default_fields', 'understrap_bootstrap_comment_form_fi * * @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' => '
' . - '
', - 'email' => '
' . - '
', - 'url' => '
' . - '
', - ); - 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' => '
' . + '
', + 'email' => '
' . + '
', + 'url' => '
' . + '
', + ); + + return $fields; + } +} // endif function_exists( 'understrap_bootstrap_comment_form_fields' ) add_filter( 'comment_form_defaults', 'understrap_bootstrap_comment_form' ); @@ -44,11 +48,15 @@ add_filter( 'comment_form_defaults', 'understrap_bootstrap_comment_form' ); * * @return mixed */ -function understrap_bootstrap_comment_form( $args ) { - $args['comment_field'] = '
- - -
'; - $args['class_submit'] = 'btn btn-secondary'; // since WP 4.1. - return $args; -} + +if ( ! function_exists( 'understrap_bootstrap_comment_form' ) ) { + + function understrap_bootstrap_comment_form( $args ) { + $args['comment_field'] = '
+ + +
'; + $args['class_submit'] = 'btn btn-secondary'; // since WP 4.1. + return $args; + } +} // endif function_exists( 'understrap_bootstrap_comment_form' )