screen->get_prefix(); $default_has_comments_website = 'yes'; if ($prefix === 'product') { $default_has_comments_website = 'no'; } $has_website_field = blocksy_get_theme_mod( $prefix . '_has_comments_website', $default_has_comments_website ); $website_field_class = ''; if ($has_website_field === 'yes') { $website_field_class = 'has-website-field'; } $label_position = blocksy_get_theme_mod($prefix . '_comments_label_position', 'inside'); $label_position_class = 'has-labels-' . $label_position; $defaults['format'] = 'xhtml'; $defaults['class_form'] = 'comment-form ' . $website_field_class . ' ' . $label_position_class; $defaults['title_reply'] = __('Leave a Reply', 'blocksy'); $defaults['cancel_reply_link'] = __('Cancel Reply', 'blocksy'); // Title reply $defaults['title_reply_before'] = $title_before . '
'; // submit button $defaults['submit_button'] = ''; if ( has_action('set_comment_cookies', 'wp_set_comment_cookies') && get_option('show_comments_cookies_opt_in') && ! is_user_logged_in() ) { $consent = empty($commenter['comment_author_email']) ? '' : ' checked="checked"'; $defaults['comment_field'] .= ''; } if (function_exists('blocksy_ext_cookies_checkbox')) { $defaults['comment_field'] .= blocksy_ext_cookies_checkbox('comment'); } return $defaults; }, 5); /** * Reorder respond form fields */ add_filter( 'comment_form_fields', function ($fields) { $prefix = blocksy_manager()->screen->get_prefix(); if ($prefix === 'product') { return $fields; } if (strpos($fields['comment'], 'rating') !== false) { return $fields; } $comment_field = $fields['comment']; unset($fields['comment']); $fields['comment'] = $comment_field; if (isset($fields['obr_hlc'])) { $comment_field = $fields['obr_hlc']; unset($fields['obr_hlc']); $fields['obr_hlc'] = $comment_field; } $commenter = wp_get_current_commenter(); $req = get_option('require_name_email'); $aria_req = ($req ? " required='required'" : ''); $has_website_field = blocksy_get_theme_mod( $prefix . '_has_comments_website', 'yes' ); $fields['author'] = ''; // Email input $fields['email'] = '
'; $website_field_output = ''; if ($has_website_field === 'yes') { $website_field_output = '
'; } $fields['url'] = $website_field_output; $fields['cookies'] = ''; return $fields; } ); /** * Comment view. * * @param object $comment comment instance. * @param array $args comment display args. * @param int $depth current depth of the comments. */ if (! function_exists('blocksy_custom_comment_template')) { function blocksy_custom_comment_template($comment, $args, $depth) { $is_by_author = blocksy_get_the_author_meta('email') === $comment->comment_author_email; $prefix = blocksy_manager()->screen->get_prefix(); $meta_with_link = apply_filters( 'blocksy:comment:date-link', true ); $has_avatar = ( 0 !== $args['avatar_size'] && get_comment_type($comment) === 'comment' && get_option('show_avatars', 1) ); $class = ''; if ($has_avatar) { $class = 'ct-has-avatar'; } if ($is_by_author) { $class .= ' ct-author-comment'; } ?>