/** * Post meta for above the post. */ function restful_post_meta_above() { global $post; ?> <div class="entry__meta-item"> <i class="fa fa-calendar"></i> <a href="<?php esc_url(get_permalink()); ?> "><?php the_time(get_option('date_format')); ?> </a> </div> <div class="entry__meta-item"> <i class="fa fa-user"></i> <a href="<?php echo esc_url(get_author_posts_url($post->post_author)); ?> "><?php the_author_meta('display_name', $post->post_author); ?> </a> </div> <?php if (comments_open() || have_comments()) { ?> <div class="entry__meta-item"> <i class="fa fa-comment"></i> <a href="<?php esc_url(comments_link()); ?> "><?php comments_number(); ?> </a> </div> <?php } ?> <?php }
function comments_evolved_template($file) { global $post, $comments; if (!(is_singular() && (have_comments() || 'open' == $post->comment_status))) { return; } return COMMENTS_EVOLVED_TEMPLATES . '/container.php'; }
public function getCommentsTemplate($default_template) { global $wpdb, $post; if (!(is_singular() && (have_comments() || 'open' == $post->comment_status))) { return $default_template; } return dirname(__FILE__) . '/comments_sohu.php'; }
function tabs_shortcode($atts, $content = null) { if (comments_open() || have_comments()) { return '<div class="responsive-tabs content-tabs">' . do_shortcode($content) . '</div>'; } else { return '<div class="responsive-tabs content-tabs">' . do_shortcode($content) . '</div><script>jQuery(document).ready(function() { RESPONSIVEUI.responsiveTabs(); }) </script>'; } }
/** * Whether to allow comments on posts or not * * @global object $post * @return boolean */ function bpmagic_allow_comments_on_posts() { global $post; $show = 0; if ('open' == $post->comment_status || have_comments()) { $show = 1; } return apply_filters('bpmag_allow_comments_on_posts', $show); //true by default }
function psp_comment_template($comment_template) { global $post; if (!(is_singular() && (have_comments() || 'open' == $post->comment_status))) { return; } if ($post->post_type == 'psp_projects') { // assuming there is a post type called business return dirname(__FILE__) . '/templates/comments.php'; } }
function theme_comments_render_list($callback) { ?> <?php if (have_comments()) { ?> <div class="cl"> </div> <h3><?php comments_number('Keine Antworten', 'Eine Antwort', '% Antworten'); ?> </h3> <ol class="all-comments"> <?php wp_list_comments('callback=' . $callback); ?> </ol> <?php if (get_comment_pages_count() > 1 && get_option('page_comments')) { // Are there comments to navigate through? ?> <div class="navigation"> <div class="alignleft"><?php previous_comments_link(); ?> </div> <div class="alignright"><?php next_comments_link(); ?> </div> </div> <?php } ?> <?php } else { ?> <?php if (comments_open()) { ?> <!-- If comments are open, but there are no comments. --> <?php } else { // comments are closed ?> <p class="nocomments">Kommentare sind geschlossen.</p> <?php } ?> <?php } ?> <?php }
/** * Adds an infinity character "∞" to the end of the post content on 'aside' posts. */ function tamatebako_post_format_aside_infinity($content) { if (has_post_format('aside') && !is_singular() && !post_password_required()) { $infinity = '<a class="permalink" href="' . esc_url(get_permalink()) . '">∞</a>'; if (have_comments() || comments_open()) { $infinity = '<a class="comments-link" href="' . esc_url(get_permalink()) . '">' . number_format_i18n(get_comments_number()) . '</a>'; } $content .= ' ' . $infinity; } return $content; }
function ultimatum_do_pings() { global $post, $wp_query; if ( ! post_type_supports( $post->post_type, 'trackbacks' ) ) return; if ( have_comments() && !empty( $wp_query->comments_by_type['pings'] ) ) { ?> <div id="pings"> <?php echo apply_filters( 'ultimatum_title_pings', __( '<h3>Trackbacks</h3>', 'ultimatum' ) ); ?> <ol class="ping-list"> <?php do_action( 'ultimatum_list_pings' ); ?> </ol> </div> <?php } else { echo apply_filters( 'ultimatum_no_pings_text', '' ); } }
<?php if (wptouch_have_posts()) { ?> <?php wptouch_the_post(); ?> <?php get_template_part('page-content'); ?> <?php } ?> </div> <!-- content --> <?php if (wptouch_fdn_show_comments_on_pages() && (comments_open() || have_comments())) { ?> <div id="comments"> <?php comments_template(); ?> </div> <?php } ?> <?php get_footer(); ?> <?php
data-width="<?php echo esc_attr($WPFBC->get_width()); ?> "></div> </div> <?php do_action('fb_after_fb_comments'); ?> <?php do_action('fb_before_old_comments'); ?> <?php if ($WPFBC->setting('show_old_comments', 'on') == 'on' && have_comments()) { ?> <div class="navigation"> <div class="alignleft"><?php previous_comments_link(); ?> </div> <div class="alignright"><?php next_comments_link(); ?> </div> </div> <?php if (has_filter('fb_comments_template')) { ?>
// Released under the GPL license // http://www.opensource.org/licenses/gpl-license.php // // ********************************************************************** // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // ********************************************************************** if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { die; } if (CFCT_DEBUG) { cfct_banner(__FILE__); } global $post, $wp_query, $comments, $comment; if (have_comments() || 'open' == $post->comment_status) { if (empty($post->post_password) || $_COOKIE['wp-postpass_' . COOKIEHASH] == $post->post_password) { $comments = $wp_query->comments; $comment_count = count($comments); $comment_count == 1 ? $comment_title = __('One Response', 'carrington-blog') : ($comment_title = sprintf(__('%d Responses', 'carrington-blog'), $comment_count)); } ?> <div class="rule-major"><hr /></div> <h2 class="h1 comments-title"><?php echo $comment_title; ?> </h2> <p><?php
<?php $total_count = get_comments(array('post_id' => $post->ID, 'type' => 'comment', 'count' => true, 'status' => 'approve')); $comments = get_comments(array('type' => 'comment', 'post_id' => $post->ID, 'status' => 'approve')); ?> <div id="comments" class="project-comments comments-area et-comments-area"> <?php if (have_comments() && $total_count > 0) { ?> <h3 class="title et-comments-title"> <?php if ($total_count == 0) { _e("0 Comments", 'comment-project'); } else { if ($total_count == 1) { printf(__("%d Comment", 'comment-project'), intval($total_count)); } else { printf(__('%d Comments', 'comment-project'), $total_count); } } ?> </h3> <ol class="comment-list"> <?php wp_list_comments(array('style' => 'ul', 'short_ping' => true, 'callback' => 'fre_project_comment_callback'), $comments); ?> </ol><!-- .comment-list --> <?php
function thb_show_comments($post_type = null) { global $post; $comments_enabled = true; // $custom_post_types = get_post_types( array('public' => true, '_builtin' => false) ); // if( !$post_type ) { // $post_type = $post->post_type; // } // if( in_array($post_type, $custom_post_types) ) { // $comments_enabled = thb_get_option($post_type . '_comments') == '1'; // } return $comments_enabled && (have_comments() || comments_open()); }
* return early without loading the comments. */ if (post_password_required()) { return; } ?> <hr /> <div class="row"> <div id="comments" class="comments-area"> <?php // You can start editing here -- including this comment! ?> <?php if (have_comments()) { ?> <h2 class="comments-title columns large-12"> <?php printf(_nx('One thought on “%2$s”', '%1$s thoughts on “%2$s”', get_comments_number(), 'comments title', 'sennzaversion3'), number_format_i18n(get_comments_number()), '<span>' . get_the_title() . '</span>'); ?> </h2> <?php if (get_comment_pages_count() > 1 && get_option('page_comments')) { // are there comments to navigate through ?> <nav id="comment-nav-above" class="comment-navigation" role="navigation"> <h1 class="screen-reader-text"><?php _e('Comment navigation', 'sennzaversion3'); ?>
<?php $req = get_option('require_name_email'); // Checks if fields are required. if ( 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']) ) die ( 'Please do not load this page directly. Thanks!' ); if ( ! empty($post->post_password) ) : if ( $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password ) : ?> <div class="nopassword"><?php _e('This post is password protected. Enter the password to view any comments.', 'uthili') ?></div> </div><!-- .comments --> <?php return; endif; endif; ?> <?php if ( have_comments() ) : ?> <?php /* numbers of pings and comments */ $ping_count = $comment_count = 0; foreach ( $comments as $comment ) get_comment_type() == "comment" ? ++$comment_count : ++$ping_count; ?> <?php if ( ! empty($comments_by_type['comment']) ) : ?> <div id="comments-list" class="comments"> <h3><?php printf($comment_count > 1 ? __('<span>%d</span> Comments', 'uthili') : __('<span>One</span> Comment', 'uthili'), $comment_count) ?></h3> <?php $total_pages = get_comment_pages_count(); if ( $total_pages > 1 ) : ?> <div id="comments-nav-above" class="comments-navigation"> <div class="paginated-comments-links"><?php paginate_comments_links(); ?></div>
function dsq_comments_template($value) { global $EMBED; global $post; global $comments; if (!(is_singular() && (have_comments() || 'open' == $post->comment_status))) { return; } if (!dsq_is_installed() || !dsq_can_replace()) { return $value; } // TODO: If a disqus-comments.php is found in the current template's // path, use that instead of the default bundled comments.php //return TEMPLATEPATH . '/disqus-comments.php'; $EMBED = true; if (dcl_check_shortcode('js-disqus') || 'open' !== $post->comment_status) { return dirname(__FILE__) . '/../public/dcl-empty.php'; } else { return dirname(__FILE__) . '/../public/dcl-comments.php'; } }
/** * Displays comment list, when there are any * * @author Konstantin Obenland * @since 1.7.0 - 16.06.2012 * * @return void */ function the_bootstrap_comments_list() { if (post_password_required()) { ?> <div id="comments"> <p class="nopassword"><?php _e('This post is password protected. Enter the password to view any comments.', 'the-bootstrap'); ?> </p> </div><!-- #comments --> <?php return; } if (have_comments()) { ?> <div id="comments"> <h2 id="comments-title"> <?php printf(_n('One thought on “%2$s”', '%1$s thoughts on “%2$s”', get_comments_number(), 'the-bootstrap'), number_format_i18n(get_comments_number()), '<span>' . get_the_title() . '</span>'); ?> </h2> <?php the_bootstrap_comment_nav(); ?> <ol class="commentlist unstyled"> <?php wp_list_comments(array('callback' => 'the_bootstrap_comment')); ?> </ol><!-- .commentlist .unstyled --> <?php the_bootstrap_comment_nav(); ?> </div><!-- #comments --> <?php } }
<p class="next-comment"><?php next_comments_link(); ?> </p> </nav> <?php } ?> <p class="comments-closed pings-open"> <?php printf(__('Comments are closed, but <a href="%s" title="Trackback URL for this post">trackbacks</a> and pingbacks are open.', 'founder'), esc_url(get_trackback_url())); ?> </p> </section> <?php } elseif (!comments_open() && have_comments()) { ?> <section id="comments" class="comments"> <div class="comments-number"> <h3> <?php comments_number(__('Comments', 'founder'), __('One Comment', 'founder'), __('% Comments', 'founder')); ?> </h3> </div> <ol class="comment-list"> <?php wp_list_comments(array('callback' => 'ct_founder_customize_comments', 'max_depth' => '3')); ?> </ol> <?php
function genesis_do_pings() { global $post, $wp_query; // Check if (is_page() && !genesis_get_option('trackbacks_pages') || is_single() && !genesis_get_option('trackbacks_posts')) { return; } if (have_comments() && !empty($wp_query->comments_by_type['pings'])) { // if have pings ?> <div id="pings"> <?php echo apply_filters('genesis_title_pings', __('<h3>Trackbacks</h3>', 'genesis')); ?> <ol class="ping-list"> <?php genesis_list_pings(); ?> </ol> </div><!-- end #pings --> <?php } else { // this is displayed if there are no pings ?> <?php echo apply_filters('genesis_no_pings_text', ''); ?> <?php } // endif have pings ?> <?php }
" /> <link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('comments_atom_url'); ?> " /> <id><?php bloginfo_rss('comments_atom_url'); ?> </id> <?php } ?> <?php if (have_comments()) { while (have_comments()) { the_comment(); $comment_post = get_post($comment->comment_post_ID); get_post_custom($comment_post->ID); ?> <entry> <title><?php if (!is_singular()) { $title = get_the_title($comment_post->ID); $title = apply_filters('the_title_rss', $title); printf(ent2ncr(__('Comment on %1$s by %2$s')), $title, get_comment_author_rss()); } else { printf(ent2ncr(__('By: %s')), get_comment_author_rss()); } ?> </title>
?> <div class="alert alert-warning"> <?php _e('Comments are closed.', 'roots'); ?> </div> <?php } ?> </section><!-- /#comments --> <?php } ?> <?php if (!have_comments() && !comments_open() && !is_page() && post_type_supports(get_post_type(), 'comments')) { ?> <section id="comments"> <div class="alert alert-warning"> <?php _e('Comments are closed.', 'roots'); ?> </div> </section><!-- /#comments --> <?php } ?> <?php if (comments_open()) { ?>
function render($params = array()) { global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity, $overridden_cpage; global $gantry; $fparams = $this->_getParams($params); $comment_layout_name = 'comment_' . $fparams->commentLayout; $layout = $gantry->_getLayout($comment_layout_name); $className = 'GantryLayout' . ucfirst($comment_layout_name); // Do not delete these lines ob_start(); if (post_password_required()) { ?> <span class="alert"><?php _ge('This post is password protected. Enter the password to view comments.'); ?> </span> <?php return ob_get_clean(); } ?> <!-- You can start editing here. --> <?php if (have_comments()) { ?> <br/> <div class="comment-section"> <div class="contentheading"><?php comments_number(_g('No Comments'), _g('1 Comment'), _g('% Comments')); ?> </div> </div> <ol class="commentlist"> <?php wp_list_comments(array('style' => 'ol', 'callback' => array($className, 'render_comment'), 'reply_text' => _g('Reply'))); ?> </ol> <div class="rt-pagination nav"> <div class="alignleft"><?php next_comments_link('« ' . _g('Older Comments')); ?> </div> <div class="alignright"><?php previous_comments_link(_g('Newer Comments') . ' »'); ?> </div> <div class="clear"></div> </div> <?php } else { // this is displayed if there are no comments so far ?> <?php if (comments_open()) { ?> <!-- If comments are open, but there are no comments. --> <?php } else { // comments are closed ?> <!-- If comments are closed. --> <div class="attention"> <div class="icon"><?php _ge('Comments are closed.'); ?> </div> </div> <?php } ?> <?php } ?> <!-- RESPOND --> <?php if (comments_open()) { ?> <div id="respond"> <div class="comment-section"> <div class="contentheading"><?php comment_form_title(_g('Leave a Reply'), _g('Leave a Reply to %s')); ?> </div> </div> <div class="cancel-comment-reply"> <small><?php cancel_comment_reply_link(); ?> </small> </div> <?php if (get_option('comment_registration') && !is_user_logged_in()) { ?> <div class="attention"> <div class="icon"><?php _ge('You must be'); ?> <a href="<?php echo wp_login_url(get_permalink()); ?> "><?php _ge('logged in'); ?> </a> <?php _ge('to post a comment.'); ?> </div> </div> <?php } else { ?> <!-- Begin Form --> <form action="<?php echo get_option('siteurl'); ?> /wp-comments-post.php" method="post" id="commentform"> <?php if (is_user_logged_in()) { ?> <p><?php _ge('Logged in as'); ?> <a href="<?php echo get_option('siteurl'); ?> /wp-admin/profile.php"><?php echo $user_identity; ?> </a>. <a href="<?php echo wp_logout_url(get_permalink()); ?> " title="<?php _ge('Log out of this account'); ?> "><?php _ge('Log out'); ?> »</a></p> <?php } else { ?> <p> <input type="text" name="author" id="author" onblur="if(this.value=='') this.value='<?php _ge('Name (Required)'); ?> ';" onfocus="if(this.value=='<?php _ge('Name (Required)'); ?> ') this.value='';" value="Name (Required)" size="22" tabindex="1" <?php if ($req) { echo "aria-required='true'"; } ?> /> </p> <p> <input type="text" name="email" id="email" onblur="if(this.value=='') this.value='<?php _ge('E-mail (Required)'); ?> ';" onfocus="if(this.value=='<?php _ge('E-mail (Required)'); ?> ') this.value='';" value="E-mail (Required)" size="22" tabindex="2" <?php if ($req) { echo "aria-required='true'"; } ?> /> </p> <p> <input type="text" name="url" id="url" onblur="if(this.value=='') this.value='<?php _ge('Website'); ?> ';" onfocus="if(this.value=='<?php _ge('Website'); ?> ') this.value='';" value="Website" size="22" tabindex="3"/> </p> <?php } ?> <!--<p><small><strong>XHTML:</strong> You can use these tags: <code><?php echo allowed_tags(); ?> </code></small></p>--> <p style="margin: 0;"> <textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea> </p><br/> <input class="button" name="submit" type="submit" id="submit" tabindex="5" value="<?php _ge('Submit'); ?> "/> <div class="clear"></div> <?php comment_id_fields(); ?> <?php do_action('comment_form', $post->ID); ?> </form> <!-- End Form --> <?php } // If registration required and not logged in ?> </div> <?php } // if you delete this the sky will fall on your head ?> <?php return ob_get_clean(); }
if ( is_singular() ) printf(ent2ncr(__('Comments on: %s')), get_the_title_rss()); elseif ( is_search() ) printf(ent2ncr(__('Comments for %s searching on %s')), get_bloginfo_rss( 'name' ), esc_attr($wp_query->query_vars['s'])); else printf(ent2ncr(__('Comments for %s')), get_bloginfo_rss( 'name' ) . get_wp_title_rss()); ?></title> <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" /> <link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link> <description><?php bloginfo_rss("description") ?></description> <lastBuildDate><?php echo mysql2date('r', get_lastcommentmodified('GMT')); ?></lastBuildDate> <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod> <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency> <?php do_action('commentsrss2_head'); ?> <?php if ( have_comments() ) : while ( have_comments() ) : the_comment(); $comment_post = get_post($comment->comment_post_ID); get_post_custom($comment_post->ID); ?> <item> <title><?php if ( !is_singular() ) { $title = get_the_title($comment_post->ID); $title = apply_filters('the_title_rss', $title); printf(ent2ncr(__('Comment on %1$s by %2$s')), $title, get_comment_author_rss()); } else { printf(ent2ncr(__('By: %s')), get_comment_author_rss()); } ?></title> <link><?php comment_link() ?></link> <dc:creator><?php echo get_comment_author_rss() ?></dc:creator>
</p> <?php } ?> </div> <?php if (get_option('woocommerce_review_rating_verification_required') === 'no' || wc_customer_bought_product('', get_current_user_id(), $product->id)) { ?> <div id="review_form_wrapper"> <div id="review_form"> <?php $commenter = wp_get_current_commenter(); $comment_form = array('title_reply' => have_comments() ? __('Leave a Feedback', 'woocommerce') : __('Be the first to feedback', 'woocommerce') . ' “' . get_the_title() . '”', 'title_reply_to' => __('Leave a Reply to %s', 'woocommerce'), 'comment_notes_before' => '', 'comment_notes_after' => '', 'fields' => array('author' => '<input id="author" class="form-control" placeholder="Name" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30" aria-required="true" /></p>', 'email' => '<input id="email" class="form-control" placeholder="Email address" name="email" type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30" aria-required="true" /></p>'), 'label_submit' => __('Send Comment', 'woocommerce'), 'logged_in_as' => '', 'comment_field' => ''); if (get_option('woocommerce_enable_review_rating') === 'yes') { $comment_form['comment_field'] = '<br><select name="rating" id="rating"> <option value="">' . __('Rate…', 'woocommerce') . '</option> <option value="5">' . __('Perfect', 'woocommerce') . '</option> <option value="4">' . __('Good', 'woocommerce') . '</option> <option value="3">' . __('Average', 'woocommerce') . '</option> <option value="2">' . __('Not that bad', 'woocommerce') . '</option> <option value="1">' . __('Very Poor', 'woocommerce') . '</option> </select></p>'; } $comment_form['comment_field'] .= '<br></textarea><textarea class="form-control" id="comment" name="comment" rows="6" placeholder="Enter your comment here..." aria-required="true"></textarea></p>'; comment_form(apply_filters('woocommerce_product_review_comment_form_args', $comment_form)); ?> </div> </div>
/** * Funzione per aggiungere il sistema dei commenti di google plus * in fondo al post standard di wordpress, sono ammesse diverse * tecniche e diversi posizionamenti, leggere la documentazione * * @return void */ function addPlusCommentsSystemTemplate($include) { global $post, $comments; if (!(is_singular() && (have_comments() || 'open' == $post->comment_status))) { return; } // Aggiornamento delle variabili che contengono le opzioni // di eleborazione commenti e loro posizione nella pagina $checkdt = '00000000'; $checkid = get_the_date('Ymd'); $options = $this->Module->getOptions(); // Calcolo la data di confronto per la funzione dei commenti if ($options['plus_comments_dt_enable'] == '1') { $checkdt = sprintf('%04d', $options['plus_comments_dt_year']); $checkdt .= sprintf('%02d', $options['plus_comments_dt_month']); $checkdt .= sprintf('%02d', $options['plus_comments_dt_day']); // Se devo controllare la data e non rientra nel range giusto non eseguo // l'elaborazione del sistema commenti e rimando a quello originale if ($checkid <= $checkdt) { return $include; } } // Controllo se devo mantenere i commenti standard di wordpress // in caso affermativo eseguo il file prima dei commenti di google plus if ($options['plus_comments_wp_enable'] == '1' and $options['plus_comments_aw_enable'] == '1') { if (file_exists($include)) { @(require $include); } } // Creazione codice HTML per inserimento widget commenti $HTML = $this->Module->getPlusCommentsCode(array('url' => get_permalink(), 'id' => 'comments-template', 'width' => '', 'title' => '', 'class0' => 'comments-area', 'class1' => trim($options['plus_comments_css_class_1']), 'class2' => trim($options['plus_comments_css_class_2']), 'action' => 'template')); echo $HTML; // Aggiunta del codice javascript per il rendering dei widget // Questo codice viene aggiungo anche dalla sidebar però viene inserito una sola volta $this->Module->addCodeJavascriptFooter(); // Ritorno stesso template passato alla funzione nel caso in cui // devo mantenere i commenti standard dopo quelli di google plus if ($options['plus_comments_wp_enable'] == '1' and $options['plus_comments_aw_enable'] == '0') { return $include; } // Ritorno template di commenti dummy con nessuna azione HTML return dirname(SZ_PLUGIN_GOOGLE_MAIN) . '/frontend/templates/sz-google-module-plus-comments-dummy.php'; }
</p> <?php } ?> </div> <?php if (get_option('woocommerce_review_rating_verification_required') === 'no' || wc_customer_bought_product('', get_current_user_id(), $product->id)) { ?> <div id="review_form_wrapper"> <div id="review_form"> <?php $commenter = wp_get_current_commenter(); $comment_form = array('title_reply' => have_comments() ? __('Add a review', 'woocommerce') : __('Be the first to review', 'woocommerce') . ' “' . get_the_title() . '”', 'title_reply_to' => __('Leave a Reply to %s', 'woocommerce'), 'comment_notes_before' => '', 'comment_notes_after' => '', 'fields' => array('author' => '<p class="comment-form-author">' . '<label for="author">' . __('Name', 'woocommerce') . ' <span class="required">*</span></label> ' . '<input id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30" aria-required="true" /></p>', 'email' => '<p class="comment-form-email"><label for="email">' . __('Email', 'woocommerce') . ' <span class="required">*</span></label> ' . '<input id="email" name="email" type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30" aria-required="true" /></p>'), 'label_submit' => __('Submit', 'woocommerce'), 'logged_in_as' => '', 'comment_field' => ''); if (get_option('woocommerce_enable_review_rating') === 'yes') { $comment_form['comment_field'] = '<p class="comment-form-rating"><label for="rating">' . __('Your Rating', 'woocommerce') . '</label><select name="rating" id="rating"> <option value="">' . __('Rate…', 'woocommerce') . '</option> <option value="5">' . __('Perfect', 'woocommerce') . '</option> <option value="4">' . __('Good', 'woocommerce') . '</option> <option value="3">' . __('Average', 'woocommerce') . '</option> <option value="2">' . __('Not that bad', 'woocommerce') . '</option> <option value="1">' . __('Very Poor', 'woocommerce') . '</option> </select></p>'; } $comment_form['comment_field'] .= '<p class="comment-form-comment"><label for="comment">' . __('Your Review', 'woocommerce') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>' . wp_nonce_field('woocommerce-comment_rating', '_wpnonce', true, false) . '</p>'; comment_form(apply_filters('woocommerce_product_review_comment_form_args', $comment_form)); ?> </div> </div>
<?php } ?> </div> <div class="multiseparator"></div> <?php if (get_option('woocommerce_review_rating_verification_required') === 'no' || wc_customer_bought_product('', get_current_user_id(), $product->id)) { ?> <div id="review_form_wrapper"> <div id="review_form" class="stm_woo_review_form"> <?php $commenter = wp_get_current_commenter(); $comment_form = array('title_reply' => have_comments() ? __('Add a review', 'woocommerce') : __('Be the first to review', 'woocommerce') . ' “' . get_the_title() . '”', 'title_reply_to' => __('Leave a Reply to %s', 'woocommerce'), 'comment_notes_before' => '', 'comment_notes_after' => '', 'fields' => array('author' => '<div class="row"><div class="col-md-6 col-sm-6"><div class="form-group">' . '<input class="form-control" id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30" aria-required="true" placeholder ="' . __('Name', 'woocommerce') . ' *"/></div></div>', 'email' => '<div class="col-md-6 col-sm-6"><div class="form-group"> ' . '<input class="form-control" id="email" name="email" type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30" aria-required="true" placeholder ="' . __('E-mail', 'woocommerce') . ' *"/></div></div></div>'), 'label_submit' => __('Submit', 'woocommerce'), 'logged_in_as' => '', 'comment_field' => ''); if (get_option('woocommerce_enable_review_rating') === 'yes') { $comment_form['comment_field'] = '<p class="comment-form-rating woo_stm_rating_fields"><label for="rating">' . __('Your Rating', 'woocommerce') . '</label><select name="rating" id="rating" class="hidden"> <option value="">' . __('Rate…', 'woocommerce') . '</option> <option value="5">' . __('Perfect', 'woocommerce') . '</option> <option value="4">' . __('Good', 'woocommerce') . '</option> <option value="3">' . __('Average', 'woocommerce') . '</option> <option value="2">' . __('Not that bad', 'woocommerce') . '</option> <option value="1">' . __('Very Poor', 'woocommerce') . '</option> </select></p>'; } $comment_form['comment_field'] .= '<div class="form-group"><textarea class="form-control" id="comment" name="comment" cols="45" rows="8" aria-required="true" placeholder ="' . __('Your Review', 'woocommerce') . ' *"></textarea></div>'; comment_form(apply_filters('woocommerce_product_review_comment_form_args', $comment_form)); ?> </div> </div>
} else { // or, if we don't have comments: /* If there are no comments and comments are closed, * let's leave a little note, shall we? */ if (!comments_open()) { ?> <?php } // end ! comments_open() ?> <?php } // end have_comments() ?> <?php $custom_comment_form = array('fields' => apply_filters('comment_form_default_fields', array('author' => '<p class="comment-form-author">' . '<input id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . ' class="required" />' . '<label for="author">' . __('Your Name', 'themify') . '</label> ' . ($req ? '<span class="required">*</span>' : '') . '</p>', 'email' => '<p class="comment-form-email">' . '<input id="email" name="email" type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . ' class="required email" />' . '<label for="email">' . __('Your Email', 'themify') . '</label> ' . ($req ? '<span class="required">*</span>' : '') . '</p>', 'url' => '<p class="comment-form-url">' . '<input id="url" name="url" type="text" value="' . esc_attr($commenter['comment_author_url']) . '" size="30"' . $aria_req . ' />' . '<label for="website">' . __('Your Website', 'themify') . '</label> ' . '</p>')), 'comment_field' => '<p class="comment-form-comment">' . '<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true" class="required"></textarea>' . '</p>', 'logged_in_as' => '<p class="logged-in-as">' . sprintf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s">Log out?</a>'), admin_url('profile.php'), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'title_reply' => __('Leave a Reply', 'themify'), 'comment_notes_before' => '', 'comment_notes_after' => '', 'cancel_reply_link' => __('Cancel', 'themify'), 'label_submit' => __('Post Comment', 'themify')); comment_form($custom_comment_form); ?> <?php if (have_comments() || comments_open()) { ?> </div> <!-- /.commentwrap --> <?php } // end commentwrap
public function sfw_comment_form_header() { global $comment; // Comment form header start if (post_password_required()) { ?> <p class="sfw-no-password">This post is password protected. Enter the password to view comments.</p> <?php return; } // if comments are open if (have_comments()) { ?> <h2 id="sfw-comments-title"> <?php printf(_n('One comment on “%2$s”', '%1$s comments on “%2$s”', get_comments_number()), number_format_i18n(get_comments_number()), '<span>' . get_the_title() . '</span>'); ?> </h2> <?php // Generates the list of comments ?> <ol class="sfw-commentlist"> <?php wp_list_comments(array('callback' => array($this, 'SFWlist_comments'))); ?> </ol> <?php // if comments are paginated (broken into pages) provides link to next and previous page if (get_comment_pages_count() > 1 && get_option('page_comments')) { // are there comments to navigate through ?> <div id="sfw-comment-nav-above"> <div class="sfw-nav-previous"> <?php previous_comments_link('← Older Comments'); ?> </div> <div class="sfw-nav-next"> <?php next_comments_link('Newer Comments →'); ?> </div> </div> <?php } } elseif (!comments_open() && !is_page() && post_type_supports(get_post_type(), 'comments')) { ?> <p class="sfw-nocomments">Comments are closed.</p> <?php } // Comment form header end // Call the comment form template $this->sfw_comment_form(); }