protected function comment($comment, $depth, $args) { // each comment markup, without </li>! $classes = implode(' ', get_comment_class()) . ($comment->comment_author_email == get_the_author_meta('email') ? ' author-comment' : ''); // get typical wp comment classes and if comment belong post autor add "author-comment" class echo '<li id="li-comment-' . get_comment_ID() . '" class="' . $classes . '">' . "\n"; // parent tag with classes and uniq id echo '<div id="comment-' . get_comment_ID() . '">' . "\n"; // anchor element with this id need to anchor links on comments works echo get_avatar($comment, 64) . "\n"; // show avatar with size 64x64 px echo '<p class="meta">Posted by: ' . get_comment_author() . "\n"; // comment autor name echo ' ' . get_comment_author_email(); // comment autor email echo ' ' . get_comment_author_url(); // comment autor url echo ' On ' . get_comment_date('F j, Y') . ' at ' . get_comment_time() . '</p>' . "\n"; // date and time of comment creating if ('0' == $comment->comment_approved) { echo '<em class="comment-awaiting-moderation">Your comment is awaiting moderation</em>' . "\n"; } // if comment is not approved notify of it comment_text() . "\n"; // display comment text $reply_link_args = array('depth' => $depth, 'reply_text' => 'Reply on it', 'login_text' => 'You must be logged to post comments'); echo get_comment_reply_link(array_merge($args, $reply_link_args)); // display reply link echo '</div>' . "\n"; // anchor element end }
protected function comment($comment, $depth, $args) { // разметка каждого комментария, без закрывающего </li>! $classes = implode(' ', get_comment_class()) . ($comment->comment_author_email == get_the_author_meta('email') ? ' author-comment' : ''); // берем стандартные классы комментария и если коммент пренадлежит автору поста добавляем класс author-comment echo '<li id="li-comment-' . get_comment_ID() . '" class="' . $classes . '">' . "\n"; // родительский тэг комментария с классами выше и уникальным id echo '<div id="comment-' . get_comment_ID() . '">' . "\n"; // элемент с таким id нужен для якорных ссылок на коммент echo get_avatar($comment, 64) . "\n"; // покажем аватар с размером 64х64 echo '<p class="meta">Автор: ' . get_comment_author() . "\n"; // имя автора коммента //echo ' '.get_comment_author_email(); // email автора коммента echo ' ' . get_comment_author_url(); // url автора коммента echo ' <br>Добавлено ' . get_comment_date('F j, Y') . ' в ' . get_comment_time() . "\n"; // дата и время комментирования if ('0' == $comment->comment_approved) { echo '<em class="comment-awaiting-moderation">Ваш комментарий будет опубликован после проверки модератором.</em>' . "\n"; } // если комментарий должен пройти проверку comment_text() . "\n"; // текст коммента $reply_link_args = array('depth' => $depth, 'reply_text' => 'Ответить', 'login_text' => 'Вы должны быть залогинены'); echo get_comment_reply_link(array_merge($args, $reply_link_args)); // выводим ссылку ответить echo '</div>' . "\n"; // закрываем див }
function et_custom_comments_display($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?> "> <div id="comment-<?php comment_ID(); ?> " class="comment-body clearfix"> <div class="avatar-container"> <?php echo get_avatar($comment, $size = '56'); ?> <span class="avatar-overlay"></span> </div> <!-- end .avatar--> <div class="comment-wrap clearfix"> <div class="comment-meta commentmetadata"><?php printf('<span class="fn">%s</span>', get_comment_author_link()); ?> - <span class="comment-date"><?php echo get_comment_date(); ?> </span> <?php edit_comment_link(esc_html__('(Edit)', 'Modest'), ' ', ''); ?> </div> <?php if ($comment->comment_approved == '0') { ?> <em class="moderation"><?php esc_html_e('Your comment is awaiting moderation.', 'Modest'); ?> </em> <br /> <?php } ?> <div class="comment-content"><?php comment_text(); ?> </div> <!-- end comment-content--> <?php $et_comment_reply_link = get_comment_reply_link(array_merge($args, array('reply_text' => esc_attr__('Reply', 'Modest'), 'depth' => $depth, 'max_depth' => $args['max_depth']))); if ($et_comment_reply_link) { echo '<div class="reply-container">' . $et_comment_reply_link . '</div>'; } ?> </div> <!-- end comment-wrap--> </div> <!-- end comment-body--> <?php }
function et_custom_comments_display($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?> "> <article id="comment-<?php comment_ID(); ?> " class="comment-body clearfix"> <?php echo get_avatar($comment, $size = '60'); ?> <?php printf('<span class="fn">%s</span>', get_comment_author_link()); ?> <span class="comment_date"> <?php /* translators: 1: date, 2: time */ printf(__('%1$s', 'Flexible'), get_comment_date()); ?> </span> <?php edit_comment_link(esc_html__('(Edit)', 'Flexible'), ' '); ?> <?php if ($comment->comment_approved == '0') { ?> <em class="moderation"><?php esc_html_e('Your comment is awaiting moderation.', 'Flexible'); ?> </em> <br /> <?php } ?> <div class="comment-content clearfix"> <?php comment_text(); ?> <?php $et_comment_reply_link = get_comment_reply_link(array_merge($args, array('reply_text' => esc_attr__('Reply', 'Flexible'), 'depth' => $depth, 'max_depth' => $args['max_depth']))); if ($et_comment_reply_link) { echo '<div class="reply-container">' . $et_comment_reply_link . '</div>'; } ?> </div> <!-- end comment-content--> </article> <!-- end comment-body --> <?php }
/** * Outputs the comment reply link. Note that WP's `comment_reply_link()` doesn't work outside of * `wp_list_comments()` without passing in the proper arguments (it isn't meant to). This function is just a * wrapper for `get_comment_reply_link()`, which adds in the arguments automatically. * * @since 0.9.0 * @access public * @param array $args * @return string */ function omega_get_comment_reply_link($args = array()) { if (!get_option('thread_comments') || in_array(get_comment_type(), array('pingback', 'trackback'))) { return ''; } $args = wp_parse_args($args, array('depth' => intval($GLOBALS['comment_depth']), 'max_depth' => get_option('thread_comments_depth'))); return get_comment_reply_link($args); }
/** * [mo_comments_list description] * @param [type] $comment [description] * @param [type] $args [description] * @param [type] $depth [description] * @return [type] [description] */ function mo_comments_list($comment, $args, $depth) { $GLOBALS['comment'] = $comment; global $commentcount, $wpdb, $post; if (!$commentcount) { //初始化楼层计数器 $comments = $wpdb->get_results("SELECT * FROM {$wpdb->comments} WHERE comment_post_ID = {$post->ID} AND comment_type = '' AND comment_approved = '1' AND !comment_parent"); $cnt = count($comments); //获取主评论总数量 $page = get_query_var('cpage'); //获取当前评论列表页码 $cpp = get_option('comments_per_page'); //获取每页评论显示数量 if (ceil($cnt / $cpp) == 1 || $page > 1 && $page == ceil($cnt / $cpp)) { $commentcount = $cnt + 1; //如果评论只有1页或者是最后一页,初始值为主评论总数 } else { $commentcount = $cpp * $page + 1; } } echo '<li '; comment_class(); echo ' id="comment-' . get_comment_ID() . '">'; //楼层 if (!($parent_id = $comment->comment_parent)) { echo '<span class="comt-f">'; printf('#%1$s', --$commentcount); echo '</span>'; } //头像 echo '<div class="comt-avatar">'; echo _get_the_avatar($user_id = $comment->user_id, $user_email = $comment->comment_author_email); echo '</div>'; //内容 echo '<div class="comt-main" id="div-comment-' . get_comment_ID() . '">'; // echo str_replace(' src=', ' data-src=', convert_smilies(get_comment_text())); comment_text(); if ($comment->comment_approved == '0') { echo '<span class="comt-approved">待审核</span>'; } echo '<div class="comt-meta"><span class="comt-author">' . get_comment_author_link() . '</span>'; echo _get_time_ago($comment->comment_date); if ($comment->comment_approved !== '0') { $replyText = get_comment_reply_link(array_merge($args, array('add_below' => 'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth']))); // echo str_replace(' href', ' href="javascript:;" data-href', $replyText ); if (strstr($replyText, 'reply-login')) { echo preg_replace('# class="[\\s\\S]*?" href="[\\s\\S]*?"#', ' class="signin-loader" href="javascript:;"', $replyText); } else { echo preg_replace('# href=[\\s\\S]*? onclick=#', ' href="javascript:;" onclick=', $replyText); } } echo '</div>'; echo '</div>'; }
function skillcrush_comments($comment, $args, $depth) { $comment = '<li class="comment">'; $comment .= '<header class="comment-head">'; $comment .= '<span class="comment-author">' . get_comment_author() . '</span>'; $comment .= '<span class="comment-meta">' . get_comment_date('m/d/Y') . ' | ' . get_comment_reply_link(array('depth' => $depth, 'max_depth' => 5)) . '</span>'; $comment .= '</header>'; $comment .= '<div class="comment-body">'; $comment .= '<p>' . get_comment_text() . '</p>'; $comment .= '</div>'; $comment .= '</li>'; echo $comment; }
function om_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <div class="comment" id="comment-<?php comment_ID(); ?> "> <div class="comment-inner depth-<?php echo esc_attr($depth); ?> " id="comment-inner-<?php comment_ID(); ?> "> <div class="comment-meta"> <div class="author"><?php printf(__('<cite class="fn">%s</cite>', 'om_theme'), get_comment_author_link()); ?> </div> <div class="date"><a href="<?php echo esc_url(get_comment_link($comment->comment_ID)); ?> "><?php printf(__('%1$s at %2$s', 'om_theme'), get_comment_date(), get_comment_time()); ?> </a></div> <?php $reply = get_comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))); $reply = preg_replace('#<a([^>]*)>([\\s\\S]*)</a>#', '<a$1><span>$2</span></a>', $reply); if ($reply) { echo '<div class="reply">' . $reply . '</div>'; } ?> <?php edit_comment_link(__('(Edit)', 'om_theme'), '<div class="edit">', '</div>'); ?> <div class="clear"></div> </div> <div class="comment-text"> <?php if (preg_match('/src=["\']([^"\']+)["\']/', get_avatar($comment->comment_author_email, 76), $m)) { $src2x = $m[1]; } else { $src2x = false; } $avatar = get_avatar($comment->comment_author_email, 38); if ($src2x) { $avatar = str_replace('src=', 'data-src-retina="' . $src2x . '" src=', $avatar); } if ($avatar) { ?> <div class="pic"> <div class="pic-inner"> <?php echo wp_kses_post($avatar); ?> </div> <div class="clear"></div> </div> <?php } ?> <div class="text<?php if ($avatar) { echo ' with-avatar'; } ?> "> <?php if ($comment->comment_approved == '0') { ?> <p><em><?php _e('Your comment is awaiting moderation.', 'om_theme'); ?> </em></p> <?php } ?> <?php comment_text(); ?> </div> <div class="clear"></div> </div> </div> <?php }
function themeFunction_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; switch ($comment->comment_type) { case 'pingback': case 'trackback': ?> <li class="post pingback"> <p><?php _e('Pingback:', 'themeTextDomain'); ?> <?php comment_author_link(); edit_comment_link(__('Edit', 'themeTextDomain'), '<span class="edit-link">', '</span>'); ?> </p> <?php break; default: ?> <li <?php comment_class('bs-example'); ?> id="li-comment-<?php comment_ID(); ?> "> <article id="comment-<?php comment_ID(); ?> " class="comment"> <footer class="comment-meta"> <div class="comment-author vcard"> <?php $avatar_size = 35; if ('0' != $comment->comment_parent) { $avatar_size = 35; } echo get_avatar($comment, $avatar_size); /* translators: 1: comment author, 2: date and time */ printf(__('%1$s %2$s', 'themeTextDomain'), sprintf('<span class="fn">%s</span>', get_comment_author_link()), sprintf('<time pubdate datetime="%2$s" itemprop="datePublished">%3$s</time>', esc_url(get_comment_link($comment->comment_ID)), get_comment_time('c'), sprintf(__('%1$s at %2$s', 'themeTextDomain'), get_comment_date(), get_comment_time()))); ?> </div><!-- .comment-author .vcard --> <?php if ($comment->comment_approved == '0') { ?> <em class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.', 'themeTextDomain'); ?> </em> <br /> <?php } ?> </footer> <div class="comment-content"><?php comment_text(); ?> </div> <div class="reply"> <?php $myclass = 'btn btn-default'; echo preg_replace('/comment-reply-link/', 'comment-reply-link ' . $myclass, get_comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'themeTextDomain'), 'depth' => $depth, 'max_depth' => $args['max_depth']))), 1); ?> </div><!-- .reply --> </article><!-- #comment-## --> <?php break; } }
function et_custom_comments_display($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?> "> <div class="comment-body-outer"> <div class="comment-body"> <div id="comment-<?php comment_ID(); ?> " class="clearfix"> <div class="avatar-box"> <?php echo get_avatar($comment, $size = '56'); ?> <span class="avatar-overlay"></span> </div> <!-- end .avatar-box --> <div class="comment-wrap clearfix"> <?php printf('<span class="fn">%s</span>', get_comment_author_link()); ?> <div class="comment-meta commentmetadata"><a href="<?php echo esc_url(get_comment_link($comment->comment_ID)); ?> "> <?php /* translators: 1: date, 2: time */ printf(__('%1$s at %2$s', 'twentyten'), get_comment_date(), get_comment_time()); ?> </a><?php edit_comment_link(esc_html__('(Edit)', 'Feather'), ' '); ?> </div><!-- .comment-meta .commentmetadata --> <?php if ($comment->comment_approved == '0') { ?> <em class="moderation"><?php esc_html_e('Your comment is awaiting moderation.', 'Feather'); ?> </em> <br /> <?php } ?> <div class="comment-content"><?php comment_text(); ?> </div> <!-- end comment-content--> <?php $et_comment_reply_link = get_comment_reply_link(array_merge($args, array('reply_text' => esc_attr__('Reply', 'Feather'), 'depth' => $depth, 'max_depth' => $args['max_depth']))); if ($et_comment_reply_link) { echo '<div class="reply-container">' . $et_comment_reply_link . '</div>'; } ?> </div> <!-- end comment-wrap--> <div class="comment-arrow"></div> </div> <!-- end comment-body--> </div> <!-- end comment-body--> </div> <!-- end comment-body-outer --> <?php }
public static function get_the_comment_meta($comment = null, $add_below = 'comment', $depth = 0, $max_depth = 0) { $comment = get_comment($comment); if (!$comment) { return; } $output = '<li class="comment-date"><span class="screen-reader-text">' . _x('Posted on', 'Used before the comment date.', 'wp-starter-theme') . '</span><time datetime="' . esc_attr(self::get_comment_time('c', false, $comment)) . '">' . self::get_the_comment_date($comment) . '</time></li>'; $output .= '<li class="comment-author"><span class="screen-reader-text">' . _x('Author', 'Used before the comment author name.', 'wp-starter-theme') . '</span>' . get_comment_author_link($comment) . '</li>'; if ('comment' === $comment->comment_type) { $output .= get_comment_reply_link(array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $max_depth, 'before' => '<li class="comment-reply-link-wrap">', 'after' => '</li>'), $comment); } ob_start(); self::edit_comment_link(null, '<li class="comment-edit-link">', '</li>', $comment); $output .= ob_get_clean(); $comment_type = $comment->comment_type ? $comment->comment_type : 'comment'; $output = '<ul class="comment-meta comment-meta-' . $comment_type . '">' . $output . '</ul>'; return $output; }
/** * Template for comments and pingbacks. * * To override this walker in a child theme without modifying the comments template * simply create your own weaverii_comment(), and that function will be used instead. * * Used as a callback by wp_list_comments() for displaying the comments. * * @since Weaver II 1.0 */ function weaverii_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; switch ($comment->comment_type) { case 'pingback': case 'trackback': ?> <li class="pingback"> <p><?php echo __('Pingback:', 'weaver-ii'); ?> <?php comment_author_link(); edit_comment_link(__('Edit', 'weaver-ii'), '<span class="edit-link">', '</span>'); ?> </p> <?php break; default: ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?> " > <article id="comment-<?php comment_ID(); ?> " class="comment"> <footer class="comment-meta"> <div class="comment-author vcard"> <?php $avatar_size = 40; if ('0' != $comment->comment_parent) { $avatar_size = 32; } echo get_avatar($comment, $avatar_size); /* translators: 1: comment author, 2: date and time */ printf(__('%1$s on %2$s <span class="says">said:</span>', 'weaver-ii'), sprintf('<span class="fn">%s</span>', get_comment_author_link()), sprintf('<a href="%1$s"><time datetime="%2$s">%3$s</time></a>', esc_url(get_comment_link($comment->comment_ID)), get_comment_time('c'), sprintf(__('%1$s at %2$s', 'weaver-ii'), get_comment_date(), get_comment_time()))); ?> <?php edit_comment_link(__('Edit', 'weaver-ii'), '<span class="edit-link">', '</span>'); ?> </div><!-- .comment-author .vcard --> <?php if ($comment->comment_approved == '0') { ?> <em class="comment-awaiting-moderation"><?php echo __('Your comment is awaiting moderation.', 'weaver-ii'); ?> </em> <br /> <?php } ?> </footer> <div class="comment-content"><?php comment_text(); ?> </div> <?php $rl = get_comment_reply_link(array_merge($args, array('reply_text' => __('Reply <span>↓</span>', 'weaver-ii'), 'depth' => $depth, 'max_depth' => $args['max_depth']))); if ($rl != '') { ?> <div class="reply"> <?php echo $rl; ?> </div><!-- .reply --> <?php } ?> </article><!-- #comment-## --> <?php break; } /* end switch */ }
/** * Display comments * * @param object $comment * @param array $args * @param int $depth */ public static function the_comments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(array('comments__item')); ?> id="li-comment-<?php comment_ID(); ?> "> <dl id="comment-<?php comment_ID(); ?> " class="comment"> <dt class="comment__header"> <div class="comment__author"> <?php echo get_avatar($comment, '48'); ?> <!-- end .comment-author --></div> </dt> <dd class="comment__body"> <?php if ($comment->comment_approved == '0') { ?> <em><?php _e('Your comment is awaiting moderation.', 'habakiri'); ?> </em> <?php } ?> <div class="comment__meta vcard"> <?php printf(__('<cite class="fn">%1$s</cite> said on %2$s at %3$s', 'habakiri'), get_comment_author_link(), get_comment_date(), get_comment_time()); edit_comment_link('edit', ' ', ''); ?> <!-- end .comment-meta --></div> <?php comment_text(); ?> <?php $comment_reply_link = get_comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))); ?> <?php if (!empty($comment_reply_link)) { ?> <div class="comment__reply reply btn btn-sm btn-primary"> <?php echo $comment_reply_link; ?> <!-- end .reply --></div> <?php } ?> </dd> </dl> <?php }
function lambda_comments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; $admincomment = 1 == $comment->user_id ? 'admin-comment' : ''; ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?> "> <article id="comment-<?php comment_ID(); ?> " class="single-comment clearfix"> <?php $avatar = get_avatar($comment, 45); if (!empty($avatar)) { ?> <figure class="comment-avatar <?php echo $admincomment; ?> "> <?php echo $avatar; ?> </figure> <?php } ?> <div class="comment-content"> <div class="comment-meta"> <span class="comment-author"><?php echo get_comment_author_link(); ?> </span> <span class="comment-time"><i class="icon-time"></i><?php echo get_comment_date() . ' - ' . get_comment_time(); ?> </span> <?php $comment_link = get_comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'delaware-theme'), 'depth' => $depth, 'max_depth' => $args['max_depth']))); ?> <?php if (!empty($comment_link)) { ?> <span class="comment-reply"> <i class="icon-reply"></i> <?php echo $comment_link; ?> </span> <?php } ?> <span class="comment-edit"><?php edit_comment_link(__('Edit Comment', 'delaware-theme'), ' ', ''); ?> </span> </div> <div class="comment-text entry-content"> <?php comment_text(); ?> <?php if ($comment->comment_approved == '0') { ?> <em><?php _e('Comment is awaiting moderation', 'delaware-theme'); ?> </em> <?php } ?> </div> </div> </article> <!-- </li> --> <?php }
function imic_comment($comment, $args, $depth) { $isByAuthor = false; if ($comment->comment_author_email == get_the_author_meta('email')) { $isByAuthor = true; } $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?> "> <div class="post-comment-block"> <div id="comment-<?php comment_ID(); ?> "> <div class="img-thumbnail"><?php echo get_avatar($comment, $size = '40'); ?> </div> <?php echo preg_replace('/comment-reply-link/', 'comment-reply-link btn btn-primary btn-xs pull-right', get_comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => __('Reply', 'framework')))), 1); echo '<h5>' . get_comment_author() . __(' says', 'framework') . '</h5>'; ?> <span class="meta-data"> <?php echo get_comment_date(); _e(' at ', 'framework'); echo get_comment_time(); ?> </span> <?php if ($comment->comment_approved == '0') { ?> <em class="moderation"><?php _e('Your comment is awaiting moderation.', 'framework'); ?> </em> <br /> <?php } ?> <?php comment_text(); ?> </div> </div> <?php }
function evolve_comment_reply($return = false) { global $comment_depth; $max_depth = get_option('thread_comments_depth'); $reply_text = apply_filters('evolve_reply_text', (string) 'Reply'); // Available filter: evolve_reply_text $login_text = apply_filters('evolve_login_text', (string) 'Log in to reply.'); // Available filter: evolve_login_text if (get_option('thread_comments') && get_comment_type() == 'comment') { if ($return) { return get_comment_reply_link(array('reply_text' => $reply_text, 'login_text' => $login_text, 'depth' => $comment_depth, 'max_depth' => $max_depth, 'before' => '<span class="comment-reply">', 'after' => '</span>')); } else { comment_reply_link(array('reply_text' => $reply_text, 'login_text' => $login_text, 'depth' => $comment_depth, 'max_depth' => $max_depth, 'before' => '<div class="comment-reply">', 'after' => '</div>')); } } }
/** * Displays a reply link for the 'comment' comment_type if threaded comments are enabled. * * @since 1.0 * @access public * @return string */ function bon_comment_reply_link_shortcode($attr) { if (!get_option('thread_comments') || 'comment' !== get_comment_type()) { return ''; } $defaults = array('reply_text' => __('Reply', 'bon'), 'login_text' => __('Log in to reply.', 'bon'), 'depth' => intval($GLOBALS['comment_depth']), 'max_depth' => get_option('thread_comments_depth'), 'before' => '', 'after' => ''); $attr = shortcode_atts($defaults, $attr); return get_comment_reply_link($attr); }
function fotos_comment_template($comment, $args, $depth) { $GLOBALS['comment'] = $comment; extract($args, EXTR_SKIP); $comreply = get_comment_reply_link(array_merge($args, array('reply_text' => 'reply', 'depth' => $depth, 'max_depth' => $args['max_depth']))); $comdate = mysql2date('l jS F, Y, g:ia', get_comment_date()); ?> <li <?php comment_class('fotos-single-comment'); ?> id="li-comment-<?php echo get_comment_ID(); ?> "><?php printf('<div id="comment-%s" class="row fotos-single-comment-pad">', get_comment_ID()); printf('<div class="span2 zmb"><span class="fotos-comment-author"><strong><a href="%s">%s</a></strong>: </span>', get_comment_author_url(), get_comment_author()); printf('</div><div class="span10 zmb"><p class="fotos-comment-content">%s</p>', get_comment_text()); printf('<p class="fotos-comment-date"><small>%s</small></p>', $comdate); printf('</div></div>'); }
function et_custom_comments_display($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?> "> <article id="comment-<?php comment_ID(); ?> " class="note-block comment-body"> <div class="note"> <div class="note-inner"> <div class="note-content"> <div class="post-title"> <div class="comment-meta commentmetadata clearfix"> <div class="avatar-box"> <?php echo get_avatar($comment, $size = '53'); ?> <span class="avatar-overlay"></span> </div> <!-- end .avatar-box --> <?php printf('<span class="fn">%s</span>', get_comment_author_link()); ?> <span class="comment_date"> <?php /* translators: 1: date, 2: time */ printf(__('%1$s', 'DailyJournal'), get_comment_date()); ?> </span> <?php edit_comment_link(esc_html__('(Edit)', 'DailyJournal'), ' '); ?> </div><!-- .comment-meta .commentmetadata --> <?php if ($comment->comment_approved == '0') { ?> <em class="moderation"><?php esc_html_e('Your comment is awaiting moderation.', 'DailyJournal'); ?> </em> <br /> <?php } ?> </div> <!-- end .post-title --> <div class="post-content"> <div class="comment-wrap clearfix"> <div class="comment-content clearfix"> <?php comment_text(); ?> </div> <!-- end comment-content--> </div> <!-- end comment-wrap --> </div> <!-- end .post-content --> </div> <!-- end .note-content--> </div> <!-- end .note-inner--> <?php $et_comment_reply_link = get_comment_reply_link(array_merge($args, array('reply_text' => esc_attr__('Reply', 'DailyJournal'), 'depth' => $depth, 'max_depth' => $args['max_depth']))); if ($et_comment_reply_link) { echo '<div class="reply-container">' . $et_comment_reply_link . '</div>'; } ?> </div> <!-- end .note--> <div class="note-bottom-left"> <div class="note-bottom-right"> <div class="note-bottom-center"></div> </div> </div> </article> <!-- end comment-body --> <?php }
public static function theme_comment($comment, $args, $depth) { global $post; $GLOBALS['comment'] = $comment; switch ($comment->comment_type) { default: $classes = ['media']; if (!empty($args['has_children'])) { $classes[] = 'parent'; } if ($comment->comment_approved == '0') { $classes[] = 'moderation'; } /** * post author checker */ if ($comment->user_id == $post->post_author) { $is_post_author = true; $classes[] = 'is-post-author'; } else { $is_post_author = false; } /** * check is my comment */ if ($comment->user_id != 0) { if (theme_cache::get_current_user_id() == $comment->user_id) { $classes[] = 'is-me'; } } /** * author url */ $author_url = get_comment_author_url(); if (!empty($author_url) && stripos($author_url, theme_cache::home_url()) === false) { $author_nofollow = ' rel="external nofollow" '; } else { $author_nofollow = null; } ?> <li <?php comment_class($classes); ?> id="comment-<?php echo $comment->comment_ID; ?> "> <div id="comment-body-<?php echo $comment->comment_ID; ?> " class="comment-body"> <?php if ($comment->comment_parent == 0) { ?> <div class="media-left"> <?php if ($author_url) { ?> <a href="<?php echo esc_url($author_url); ?> " class="avatar-link" target="_blank" <?php echo $author_nofollow; ?> > <?php echo theme_cache::get_avatar($comment, 50); ?> </a> <?php } else { echo theme_cache::get_avatar($comment, 50); } ?> </div><!-- /.media-left --> <?php } ?> <div class="media-body"> <div class="comment-content"> <?php comment_text(); ?> <?php if ($comment->comment_approved == '0') { ?> <div class="comment-awaiting-moderation"><?php echo status_tip('info', ___('Your comment is awaiting moderation.')); ?> </div> <?php } ?> </div> <h4 class="media-heading"> <span class="comment-meta-data author"> <?php if ($comment->comment_parent != 0) { echo theme_cache::get_avatar($comment, 50), ' '; } comment_author_link(); ?> </span> <time class="comment-meta-data time" datetime="<?php echo get_comment_time('c'); ?> "> <a href="<?php echo esc_url(get_comment_link($comment->comment_ID)); ?> "><?php echo friendly_date(get_comment_time('U')); ?> </a> </time> <?php if (!theme_cache::is_user_logged_in()) { /** * if needs register to comment */ if (theme_cache::get_option('comment_registration')) { static $reply_link; if (!$reply_link) { $reply_link = '<a rel="nofollow" class="comment-reply-login quick-login-btn" href="' . wp_login_url(theme_cache::get_permalink($comment->comment_post_ID)) . '">' . ___('Reply') . '</a>'; } } else { $reply_link = get_comment_reply_link(['add_below' => 'comment-body', 'depth' => $depth, 'max_depth' => $args['max_depth']], $comment, $post->ID); } } else { $reply_link = get_comment_reply_link(['add_below' => 'comment-body', 'depth' => $depth, 'max_depth' => $args['max_depth']], $comment, $post->ID); } $reply_link = preg_replace('/(href=)[^\\s]+/', '$1"javascript:;"', $reply_link); if (!empty($reply_link)) { ?> <span class="comment-meta-data comment-reply reply"> <?php echo $reply_link; ?> </span><!-- .reply --> <?php } ?> </h4> </div><!-- /.media-body --> </div><!-- /.comment-body --> <?php } }
?> </p> <?php } ?> </header><!-- .comment-meta --> <div class="comment-content"> <?php comment_text(); ?> </div><!-- .comment-content --> <footer class="comment-metadata"> <?php if (get_comment_reply_link(array_merge($args, array('add_below' => 'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth'])))) { ?> <span class="comment-reply"> <?php comment_reply_link(array_merge($args, array('add_below' => 'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth']))); ?> </span> <?php } ?> <span class="comment-time"> <a href="<?php echo esc_url(get_comment_link($comment->comment_ID, $args)); ?> "> <time datetime="<?php
/** * Comment renderer function. * * @param Comment $comment comment instance. * @param array $args array of options. * @param int $depth current depth level. * @return void */ function adventure_tours_comment_renderer($comment, $args, $depth) { $commentHtml = get_avatar($comment, 90) . '<div class="comments__item__info">' . '<div class="comments__item__name">' . get_comment_author_link() . '</div>' . '<div class="comments__item__reply-link">' . get_comment_reply_link(array('depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => esc_html__('Reply', 'adventure-tours'), 'login_text' => '')) . '</div>' . '</div>' . '<div class="comments__item__date">' . get_comment_date() . '</div>' . '<div class="comments__item__text">' . get_comment_text() . '</div>'; printf('<div class="%s" id="comment-%s">%s%s', implode(' ', get_comment_class('comments__item')), get_comment_ID(), $commentHtml, !empty($args['has_children']) ? '</div><div class="comments__item__reply">' : ''); }
function x_icon_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; switch ($comment->comment_type) { case 'pingback': // 1 // 1 case 'trackback': // 1 ?> <li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?> "> <p><?php _e('Pingback:', '__x__'); ?> <?php comment_author_link(); ?> <?php edit_comment_link(__('(Edit)', '__x__'), '<span class="edit-link">', '</span>'); ?> </p> <?php break; default: // 2 global $post; if (X_WOOCOMMERCE_IS_ACTIVE) { $rating = esc_attr(get_comment_meta($GLOBALS['comment']->comment_ID, 'rating', true)); } if (x_is_product()) { $comment_time = sprintf(__('%1$s', '__x__'), get_comment_date()); } else { $comment_time = sprintf(__('%1$s at %2$s', '__x__'), get_comment_date(), get_comment_time()); } ?> <li id="li-comment-<?php comment_ID(); ?> " <?php comment_class(); ?> > <?php $comment_reply = !x_is_product() ? '<div class="x-reply">' . get_comment_reply_link(array_merge($args, array('reply_text' => __('Reply<span class="comment-reply-link-after"><i class="x-icon-reply" data-x-icon=""></i></span>', '__x__'), 'depth' => $depth, 'max_depth' => $args['max_depth']))) . '</div>' : ''; ?> <?php printf('<div class="x-comment-img">%1$s %2$s %3$s</div>', '<span class="avatar-wrap cf">' . get_avatar($comment, 120) . '</span>', $comment->user_id === $post->post_author ? '<span class="bypostauthor">' . __('Post<br>Author', '__x__') . '</span>' : '', $comment_reply); ?> <article id="comment-<?php comment_ID(); ?> " class="comment"> <header class="x-comment-header"> <?php printf('<cite class="x-comment-author">%1$s</cite>', get_comment_author_link()); if (x_is_product() && get_option('woocommerce_enable_review_rating') == 'yes') { ?> <div class="star-rating-container"> <div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating" class="star-rating" title="<?php echo sprintf(__('Rated %d out of 5', '__x__'), $rating); ?> "> <span style="width:<?php echo intval(get_comment_meta($GLOBALS['comment']->comment_ID, 'rating', true)) / 5 * 100; ?> %"><strong itemprop="ratingValue"><?php echo intval(get_comment_meta($GLOBALS['comment']->comment_ID, 'rating', true)); ?> </strong> <?php _e('out of 5', '__x__'); ?> </span> </div> </div> <?php } printf('<div><a href="%1$s" class="x-comment-time"><time datetime="%2$s">%3$s</time></a></div>', esc_url(get_comment_link($comment->comment_ID)), get_comment_time('c'), $comment_time); edit_comment_link(__('<i class="x-icon-edit" data-x-icon=""></i> Edit', '__x__')); ?> </header> <?php if ('0' == $comment->comment_approved) { ?> <p class="x-comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.', '__x__'); ?> </p> <?php } ?> <section class="x-comment-content"> <?php comment_text(); ?> </section> </article> <?php break; } }
"><i class="fa fa-home"></i></a> <?php } ?> <span class="text-muted"><small><?php echo human_time_diff(get_comment_time('U'), current_time('timestamp')) . ' ' . __('ago', 'gitsta'); ?> </small></span> <span class="pull-right"> <?php echo edit_comment_link('<i class="fa fa-edit"></i> Edit'); ?> <?php echo get_comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => '<i class="fa fa-reply"></i> ' . __('Reply', 'gitsta')))); ?> </span> <?php if ($comment->comment_approved == 0) { ?> <p class="pull-right text-muted"><?php _e('Your comment is awaiting moderation.', 'gitsta'); ?> </p> <?php } ?> </div>
/** * Returns a string that can be echoed to create a `reply` link for comments. * * @since 4.0.4 * @global int $comment_depth * @param array $args Arguments. * @return string $output `Reply` link. */ function cherry_get_the_post_comment_reply_link($args) { global $comment_depth; $reply = get_comment_reply_link(array_merge($args, array('add_below' => 'div-comment', 'depth' => $comment_depth, 'max_depth' => get_option('thread_comments_depth') ? get_option('thread_comments_depth') : -1, 'before' => '', 'after' => ''))); /** * Filter a `reply` link for comments. * * @since 4.0.4 * @param string $reply `reply` link. * @param array $args Arguments. */ return apply_filters('cherry_get_the_post_comment_reply_link', $reply, $args); }
/** * Echo the comment links. * * @since 1.0.0 */ function beans_comment_links() { global $comment; echo beans_open_markup('beans_comment_links', 'ul', array('class' => 'tm-comment-links uk-subnav uk-subnav-line')); // Reply. echo get_comment_reply_link(array_merge($comment->args, array('add_below' => 'comment-content', 'depth' => $comment->depth, 'max_depth' => $comment->args['max_depth'], 'before' => beans_open_markup('beans_comment_item[_reply]', 'li'), 'after' => beans_close_markup('beans_comment_item[_reply]', 'li')))); // Edit. if (current_user_can('moderate_comments')) { echo beans_open_markup('beans_comment_item[_edit]', 'li'); echo beans_open_markup('beans_comment_item_link[_edit]', 'a', array('href' => esc_url(get_edit_comment_link($comment->comment_ID)))); echo beans_output('beans_comment_edit_text', __('Edit', 'tm-beans')); echo beans_close_markup('beans_comment_item_link[_edit]', 'a'); echo beans_close_markup('beans_comment_item[_edit]', 'li'); } // Link. echo beans_open_markup('beans_comment_item[_link]', 'li'); echo beans_open_markup('beans_comment_item_link[_link]', 'a', array('href' => esc_url(get_comment_link($comment->comment_ID)))); echo beans_output('beans_comment_link_text', __('Link', 'tm-beans')); echo beans_close_markup('beans_comment_item_link[_link]', 'a'); echo beans_close_markup('beans_comment_item[_link]', 'li'); echo beans_close_markup('beans_comment_links', 'ul'); }
/** * Displays the HTML content for reply to comment link. * * @since 2.7.0 * * @see get_comment_reply_link() * * @param array $args Optional. Override default options. * @param int $comment Comment being replied to. Default current comment. * @param int|WP_Post $post Post ID or WP_Post object the comment is going to be displayed on. * Default current post. * @return mixed Link to show comment form, if successful. False, if comments are closed. */ function comment_reply_link($args = array(), $comment = null, $post = null) { echo get_comment_reply_link($args, $comment, $post); }
/** * Template for comments and pingbacks. * * * Used as a callback by wp_list_comments() for displaying the comments. * Inspired from Twenty Twelve 1.0 * @package Customizr * @since Customizr 1.0 */ function tc_comment_callback($comment, $args, $depth) { $GLOBALS['comment'] = $comment; //get user defined max comment depth $max_comments_depth = get_option('thread_comments_depth'); $max_comments_depth = isset($max_comments_depth) ? $max_comments_depth : 5; ob_start(); switch ($comment->comment_type) { case 'pingback': case 'trackback': // Display trackbacks differently than normal comments. ?> <li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?> "> <article id="comment-<?php comment_ID(); ?> " class="comment"> <p><?php _e('Pingback:', 'customizr'); ?> <?php comment_author_link(); ?> <?php edit_comment_link(__('(Edit)', 'customizr'), '<span class="edit-link btn btn-success btn-mini">', '</span>'); ?> </p> </article> <?php break; default: // Proceed with normal comments. global $post; ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?> "> <?php //when do we display the comment content? $tc_show_comment_content = 1 == get_option('thread_comments') && $depth < $max_comments_depth && comments_open(); //gets the comment text => filter parameter! $comment_text = get_comment_text($comment->comment_ID, $args); printf('<article class="comment"><div class="%1$s"><div class="%2$s">%3$s</div><div class="%4$s">%5$s %6$s %7$s %8$s</div></div></article>', apply_filters('tc_comment_wrapper_class', 'row-fluid'), apply_filters('tc_comment_avatar_class', 'comment-avatar span2'), get_avatar($comment, apply_filters('tc_comment_avatar_size', 80)), apply_filters('tc_comment_content_class', 'span10'), $tc_show_comment_content ? sprintf('<div class="%1$s">%2$s</div>', apply_filters('tc_comment_reply_btn_class', 'reply btn btn-small'), get_comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'customizr') . ' <span>↓</span>', 'depth' => $depth, 'max_depth' => $args['max_depth'], 'add_below' => apply_filters('tc_comment_reply_below', 'li-comment'))))) : '', sprintf('<header class="comment-meta comment-author vcard">%1$s %2$s</header>', sprintf('<cite class="fn">%1$s %2$s %3$s</cite>', get_comment_author_link(), $comment->user_id === $post->post_author ? '<span> ' . __('Post author', 'customizr') . '</span>' : '', current_user_can('edit_comment', $comment->comment_ID) ? '<p class="edit-link btn btn-success btn-mini"><a class="comment-edit-link" href="' . get_edit_comment_link($comment->comment_ID) . '">' . __('Edit', 'customizr') . '</a></p>' : ''), sprintf('<a class="comment-date" href="%1$s"><time datetime="%2$s">%3$s</time></a>', esc_url(get_comment_link($comment->comment_ID)), get_comment_time('c'), sprintf(__('%1$s at %2$s', 'customizr'), get_comment_date(), get_comment_time()))), '0' == $comment->comment_approved ? sprintf('<p class="comment-awaiting-moderation">%1$s</p>', __('Your comment is awaiting moderation.', 'customizr')) : '', sprintf('<section class="comment-content comment">%1$s</section>', apply_filters('comment_text', $comment_text, $comment, $args))); //end printf ?> <!-- #comment-## --> <?php break; } // end comment_type check $html = ob_get_contents(); if ($html) { ob_end_clean(); } echo apply_filters('tc_comment_callback', $html, $comment, $args, $depth, $max_comments_depth); }
/** * Add extra fields we need in the front-end. * * @since 0.0.4 * * @param array|object $comment Comment as array * @param bool $flatten Optional. If true, will remove all hierarchy. Default is false. * * @return array Comment as array with extra fields. */ public static function add_data_to_comment($comment, $flatten = false) { if (is_object($comment)) { $comment = (array) $comment; } $key = __FUNCTION__ . $comment['comment_post_ID'] . $comment['comment_ID']; if (false != ($_comment = wp_cache_get($key, self::$cache_group))) { return $_comment; } $max_depth = (int) get_option('thread_comments_depth', 5); $date_format = get_option('date_format'); $time_format = get_option('time_format'); $time = strtotime($comment['comment_date']); //filter content (make_clickable, wpautop, etc) $comment['comment_content'] = apply_filters('comment_text', $comment['comment_content']); //use display name for comment $comment['comment_author'] = self::find_user_display_name($comment); //add avatar markup as a string $comment['author_avatar'] = get_avatar($comment['comment_author_email'], 48); //format date according to WordPress settings /* translators: 1: date, 2: time */ $comment['comment_date'] = sprintf(__('%1$s at %2$s', 'epoch'), date($date_format, $time), date($time_format, $time)); //get comment link $comment['comment_link'] = get_comment_link($comment['comment_ID']); //are comments replies allowed $comment['reply_allowed'] = comments_open($comment['comment_post_ID']); //remove parent_id if $flatten if ($flatten) { $comment['comment_parent'] = "0"; } else { $parents = self::find_parents($comment['comment_ID']); if (empty($parents)) { $comment['depth'] = 1; } else { $count = count($parents); if ($count > $max_depth) { $comment['comment_parent'] = $parents[$max_depth - 1]; $count = $max_depth; } $comment['depth'] = $count; } } //if has no children add that key as false. if ($flatten || !isset($comment['children'])) { $comment['children'] = false; } $comment['list_class'] = $comment['comment_parent'] == '0' ? '' : 'children'; if (!$flatten) { //get reply link $reply_link_args = array('add_below' => 'comment', 'max_depth' => $max_depth, 'depth' => (int) $comment['depth']); $comment['reply_link'] = get_comment_reply_link($reply_link_args, (int) $comment['comment_ID']); } else { $comment['reply_link'] = ''; } wp_cache_set($key, $comment, self::$cache_group, HOUR_IN_SECONDS); return $comment; }
public function get_comment_reply_link($args = array(), $comment = null, $post = null) { return get_comment_reply_link($args, $comment, $post); }