/** * Uses the $comment_type to determine which comment template should be used. Once the * template is located, it is loaded for use. Child themes can create custom templates based off * the $comment_type. The comment template hierarchy is comment-$comment_type.php, * comment.php. * * The templates are saved in $omega->comment_template[$comment_type], so each comment template * is only located once if it is needed. Following comments will use the saved template. * * @since 0.2.3 * @access public * @param $comment The comment object. * @param $args Array of arguments passed from wp_list_comments(). * @param $depth What level the particular comment is. * @return void */ function omega_comments_callback($comment, $args, $depth) { global $omega; /* Get the comment type of the current comment. */ $comment_type = get_comment_type($comment->comment_ID); /* Create an empty array if the comment template array is not set. */ if (!isset($omega->comment_template) || !is_array($omega->comment_template)) { $omega->comment_template = array(); } /* Check if a template has been provided for the specific comment type. If not, get the template. */ if (!isset($omega->comment_template[$comment_type])) { /* Create an array of template files to look for. */ $templates = array("comment-{$comment_type}.php", "comment/{$comment_type}.php"); /* If the comment type is a 'pingback' or 'trackback', allow the use of 'comment-ping.php'. */ if ('pingback' == $comment_type || 'trackback' == $comment_type) { $templates[] = 'comment-ping.php'; $templates[] = 'comment/ping.php'; } /* Add the fallback 'comment.php' template. */ $templates[] = 'comment/comment.php'; $templates[] = 'comment.php'; /* Allow devs to filter the template hierarchy. */ $templates = apply_filters('omega_comment_template_hierarchy', $templates, $comment_type); /* Locate the comment template. */ $template = locate_template($templates); /* Set the template in the comment template array. */ $omega->comment_template[$comment_type] = $template; } /* If a template was found, load the template. */ if (!empty($omega->comment_template[$comment_type])) { require $omega->comment_template[$comment_type]; } }
function sf_custom_comments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; $GLOBALS['comment_depth'] = $depth; ?> <li id="comment-<?php comment_ID(); ?> " <?php comment_class('clearfix'); ?> > <div class="comment-wrap clearfix"> <div class="comment-avatar"> <?php if (function_exists('get_avatar')) { echo get_avatar($comment, '100'); } ?> <?php if ($comment->comment_author_email == get_the_author_meta('email')) { ?> <span class="tooltip"><?php _e("Author", "swiftframework"); ?> <span class="arrow"></span></span> <?php } ?> </div> <div class="comment-content"> <div class="comment-meta"> <?php printf('<span class="comment-author">%1$s</span> <span class="comment-date">%2$s</span>', get_comment_author_link(), human_time_diff(get_comment_time('U'), current_time('timestamp')) . ' ' . __("ago", "swiftframework")); ?> <div class="comment-meta-actions"> <?php edit_comment_link(__('Edit', 'swiftframework'), '<span class="edit-link">', '</span><span class="meta-sep"> |</span>'); ?> <?php if ($args['type'] == 'all' || get_comment_type() == 'comment') { comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'swiftframework'), 'login_text' => __('Log in to reply.', 'swiftframework'), 'depth' => $depth, 'before' => '<span class="comment-reply">', 'after' => '</span>'))); } ?> </div> </div> <?php if ($comment->comment_approved == '0') { _e("\t\t\t\t\t<span class='unapproved'>Your comment is awaiting moderation.</span>\n", 'swiftframework'); } ?> <div class="comment-body"> <?php comment_text(); ?> </div> </div> </div> <?php }
/** * Uses the $comment_type to determine which comment template should be used. * Once the template is located, it is loaded for use. * * Child themes can create custom templates based off the $comment_type. The * comment template hierarchy is comment-$comment_type.php, comment.php. * * Templates are saved in CareLib_Template_Comments::comment_template[$comment_type], * so each comment template is only located once if it is needed. The * following comments will use the saved template. * * @since 1.0.0 * @access public * @param object $comment the comment object. * @param array $args list of arguments passed from wp_list_comments(). * @param integer $depth What level the particular comment is. * @return void */ function carelib_comments_callback($comment, $args, $depth) { static $comment_template = array(); // Get the comment type of the current comment. $comment_type = get_comment_type($comment->comment_ID); // Check if a template has been provided for the specific comment type. If not, get the template. if (!isset($comment_template[$comment_type])) { // Create an array of template files to look for. $templates = array("template-parts/comment/{$comment_type}.php", "comment-{$comment_type}.php"); // If the comment type is a 'pingback' or 'trackback', allow the use of 'comment-ping.php'. if ('pingback' === $comment_type || 'trackback' === $comment_type) { $templates[] = 'template-parts/comment/ping.php'; $templates[] = 'comment-ping.php'; } // Add the fallback 'comment.php' template. $templates[] = 'template-parts/comment/comment.php'; $templates[] = 'comment.php'; // Allow devs to filter the template hierarchy. $templates = apply_filters("{$GLOBALS['carelib_prefix']}_comment_template_hierarchy", $templates, $comment_type); // Locate the comment template. $template = locate_template($templates); // Set the template in the comment template array. $comment_template[$comment_type] = $template; } // If a template was found, load the template. if (!empty($comment_template[$comment_type])) { require $comment_template[$comment_type]; } }
/** * Uses the `$comment_type` to determine which comment template should be used. Once the * template is located, it is loaded for use. Child themes can create custom templates based off * the `$comment_type`. The comment template hierarchy is `comment-$comment_type.php`, * `comment.php`. * * The templates are saved in `$hybrid->comment_template[$comment_type]`, so each comment template * is only located once if it is needed. Following comments will use the saved template. * * @since 0.2.3 * @access public * @global object $hybrid * @param object $comment * @return void */ function hybrid_comments_callback($comment) { global $hybrid; // Get the comment type of the current comment. $comment_type = get_comment_type($comment->comment_ID); // Create an empty array if the comment template array is not set. if (!isset($hybrid->comment_template) || !is_array($hybrid->comment_template)) { $hybrid->comment_template = array(); } // Check if a template has been provided for the specific comment type. If not, get the template. if (!isset($hybrid->comment_template[$comment_type])) { // Create an array of template files to look for. $templates = array("comment-{$comment_type}.php", "comment/{$comment_type}.php"); // If the comment type is a 'pingback' or 'trackback', allow the use of 'comment-ping.php'. if ('pingback' == $comment_type || 'trackback' == $comment_type) { $templates[] = 'comment-ping.php'; $templates[] = 'comment/ping.php'; } // Add the fallback 'comment.php' template. $templates[] = 'comment/comment.php'; $templates[] = 'comment.php'; // Allow devs to filter the template hierarchy. $templates = apply_filters('hybrid_comment_template_hierarchy', $templates, $comment_type); // Locate the comment template. $template = locate_template($templates); // Set the template in the comment template array. $hybrid->comment_template[$comment_type] = $template; } // If a template was found, load the template. if (!empty($hybrid->comment_template[$comment_type])) { require $hybrid->comment_template[$comment_type]; } }
function sandbox_trackbacks($comment, $args, $depth) { $GLOBALS['comment'] = $comment; extract($args, EXTR_SKIP); global $sandbox_comment_alt; ?> <?php if (get_comment_type() != "comment") { ?> <li id="comment-<?php comment_ID(); ?> " class="<?php sandbox_comment_class(); ?> "> <div class="comment-author"><?php printf(__('By %1$s on %2$s at %3$s', 'sandbox'), get_comment_author_link(), get_comment_date(), get_comment_time()); edit_comment_link(__('Edit', 'sandbox'), ' <span class="meta-sep">|</span> <span class="edit-link">', '</span>'); ?> </div> <?php if ($comment->comment_approved == '0') { _e('\\t\\t\\t\\t\\t<span class="unapproved">Your trackback is awaiting moderation.</span>\\n', 'sandbox'); } ?> <?php comment_text(); ?> </li> <?php } }
/** * Uses the $comment_type to determine which comment template should be used. Once the * template is located, it is loaded for use. * * @since 1.0 * @param $comment The comment variable * @param $args Array of arguments passed from wp_list_comments() * @param $depth What level the particular comment is */ function momtaz_comments_callback($comment, $args, $depth) { $GLOBALS['comment'] = $comment; $GLOBALS['comment_depth'] = $depth; $GLOBALS['max_depth'] = $args['max_depth']; // Locate the template based on the $comment_type. Default to 'comment.php'. momtaz_template_part('comment', get_comment_type($comment->comment_ID)); }
/** * Custom callback function to list comments in the Thematic style. * * If you want to use your own comments callback for wp_list_comments, filter list_comments_arg * * @param object $comment * @param array $args * @param int $depth */ function thematic_comments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; $GLOBALS['comment_depth'] = $depth; ?> <li id="comment-<?php comment_ID(); ?> " <?php comment_class(); ?> > <?php // action hook for inserting content above #comment thematic_abovecomment(); ?> <div class="comment-author vcard"><?php thematic_commenter_link(); ?> </div> <?php thematic_commentmeta(TRUE); ?> <?php if ($comment->comment_approved == '0') { echo "\t\t\t\t\t" . '<span class="unapproved">'; _e('Your comment is awaiting moderation', 'thematic'); echo ".</span>\n"; } ?> <div class="comment-content"> <?php comment_text(); ?> </div> <?php // echo the comment reply link with help from Justin Tadlock http://justintadlock.com/ and Will Norris http://willnorris.com/ if ($args['type'] == 'all' || get_comment_type() == 'comment') { comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'thematic'), 'login_text' => __('Log in to reply.', 'thematic'), 'depth' => $depth, 'before' => '<div class="comment-reply-link">', 'after' => '</div>'))); } ?> <?php // action hook for inserting content above #comment thematic_belowcomment(); ?> <?php }
public static function get_comment_type_label($comment_id) { $comment_type = get_comment_type($comment_id); if (empty($comment_type)) { $comment_type = 'comment'; } $comment_type_labels = self::get_comment_type_labels(); $label = isset($comment_type_labels[$comment_type]) ? $comment_type_labels[$comment_type] : $comment_type; return $label; }
function wpi_get_comment_text_filter($content) { global $comment; $type = get_comment_type(); if ($type != 'comment') { $htm = call_user_func_array('wpi_' . $type . '_footer', array($comment)); if (!empty($htm)) { $content .= _t('span', $htm, array('class' => 'db cb cf comment-footer')); } } return $content; }
function get_ping_type($trackbacktxt = 'Trackback', $pingbacktxt = 'Pingback') { $type = get_comment_type(); switch ($type) { case 'trackback': return $trackbacktxt; break; case 'pingback': return $pingbacktxt; break; } return false; }
/** * Template for comments and pingbacks. * Used as a callback by wp_list_comments() for displaying the comments. * * @param string $comment * @param array $args * @param int $depth * * @see wp_list_comments() * * @return void */ function constructent_comment_callback($comment, $args, $depth) { $GLOBALS['comment'] = $comment; $comment_type = get_comment_type($comment->comment_ID); $templates = array("comment-{$comment_type}.php"); // If the comment type is a 'pingback' or 'trackback', allow the use of 'comment-ping.php' if ('pingback' == $comment_type || 'trackback' == $comment_type) { $templates[] = 'comment-ping.php'; } // Add the fallback 'comment.php' template $templates[] = 'comment.php'; if ($template = locate_template($templates)) { include $template; } }
function pl_recent_comments($number = 3) { $comments = get_comments(array('number' => $number, 'status' => 'approve')); if ($comments) { foreach ((array) $comments as $comment) { if ('comment' != get_comment_type($comment)) { continue; } $post = get_post($comment->comment_post_ID); $link = get_comment_link($comment->comment_ID); $avatar = pl_get_avatar_url(get_avatar($comment)); $img = $avatar ? sprintf('<div class="img rtimg"><a class="the-media" href="%s" style="background-image: url(%s)"></a></div>', $link, $avatar) : ''; printf('<li class="media fix">%s<div class="bd"><div class="the-quote pl-contrast"><div class="title" >"%s"</div><div class="excerpt">on <a href="%s">%s</a></div></div></div></li>', $img, stripslashes(substr(wp_filter_nohtml_kses($comment->comment_content), 0, 50)), $link, custom_trim_excerpt($post->post_title, 3)); } } }
function custom_comments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; $GLOBALS['comment_depth'] = $depth; ?> <li id="comment-<?php comment_ID(); ?> " <?php comment_class(); ?> > <div class="comment-author vcard"><?php commenter_link(); ?> </div> <div class="comment-meta"><?php printf(__('Posted %1$s at %2$s <span class="meta-sep">|</span> <a href="%3$s" title="Permalink to this comment">Permalink</a>', 'your-theme'), get_comment_date(), get_comment_time(), '#comment-' . get_comment_ID()); edit_comment_link(__('Edit', 'your-theme'), ' <span class="meta-sep">|</span> <span class="edit-link">', '</span>'); ?> </div> <div class="comment-content"> <?php comment_text(); ?> </div> <?php // echo the comment reply link if ($args['type'] == 'all' || get_comment_type() == 'comment') { comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'your-theme'), 'login_text' => __('Log in to reply.', 'your-theme'), 'depth' => $depth, 'before' => '<div class="comment-reply-link">', 'after' => '</div>'))); } ?> <?php if ($comment->comment_approved == '0') { _e("\t\t\t\t\t<span class='info'>Your comment is awaiting moderation.</span>\n", 'your-theme'); } ?> <?php }
function gplus_custom_pings($comment, $args, $depth) { $GLOBALS['comment'] = $comment; if ('pingback' == get_comment_type()) { $pingtype = 'Pingback'; } else { $pingtype = 'Trackback'; } ?> <li> <?php comment_author_link(); ?> - <?php echo $pingtype; ?> on <?php echo mysql2date('Y/m/d/ H:i', $comment->comment_date); }
function highlight_comment() { global $comment, $user_email, $comment_author_email, $posts; $authordata = get_userdata($posts[0]->post_author); get_currentuserinfo(); if ($comment->comment_author_email and get_comment_type() == 'comment') { if ($comment->comment_author_email == $authordata->user_email) { //highlight author echo 'class="author-comment"'; } elseif ($comment->comment_author_email == $user_email) { //highlight user if not author echo 'class="user-comment"'; } elseif ($comment->comment_author_email == $comment_author_email) { //highlight commenter if not user echo 'class="user-comment"'; } } if (get_comment_type() != 'comment') { echo 'class="ping-comment"'; } }
/** * Callback function for choosing the comment template * @version 2 */ function apoc_comments_template($comment, $args, $depth) { // Determine the post type for this comment $apoc = apoc(); $post_type = isset($apoc->post_type) ? $apoc->post_type : 'post'; $comment_type = get_comment_type($comment->comment_ID); // Is the comment count already set? if (isset($apoc->counts['comment'])) { $count = ++$apoc->counts['comment']; } else { // Get comment page $apoc->counts['cpage'] = '' == $args['page'] ? get_query_var('cpage') : $args['page']; // Adjust the count $adj = ($apoc->counts['cpage'] - 1) * $args['per_page']; $count = $adj + 1; // Update the object $apoc->counts['comment'] = $count; } // Load the comment template include THEME_DIR . '/library/templates/comment.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 $comments, $comment; ?> <ol class="pings-list hfeed"> <?php foreach ($comments as $comment) { if (get_comment_type() != 'comment') { ?> <li class="hentry <?php cfct_comment_list_class(); ?> "> <?php cfct_comment(); ?> </li><!--.hentry--> <?php } } ?> </ol><!--/#pings-list-->
/** * Sets a class for each comment. Sets alt, odd/even, and author/user classes. Adds author, user, * and reader classes. Needs more work because WP, by default, assigns even/odd backwards * (Odd should come first, even second). * * @since 0.2.0 * @global $wpdb WordPress DB access object. * @global $comment The current comment's DB object. */ function hybrid_comment_class( $class = '' ) { global $post, $comment, $hybrid; /* Gets default WP comment classes. */ $classes = get_comment_class( $class ); /* Get the comment type. */ $classes[] = get_comment_type(); /* User classes to match user role and user. */ if ( $comment->user_id > 0 ) { /* Create new user object. */ $user = new WP_User( $comment->user_id ); /* Set a class with the user's role. */ if ( is_array( $user->roles ) ) { foreach ( $user->roles as $role ) $classes[] = "role-{$role}"; } /* Set a class with the user's name. */ $classes[] = 'user-' . sanitize_html_class( $user->user_nicename, $user->ID ); } /* If not a registered user */ else { $classes[] = 'reader'; } /* Comment by the entry/post author. */ if ( $post = get_post( $post_id ) ) { if ( $comment->user_id === $post->post_author ) $classes[] = 'entry-author'; } /* Join all the classes into one string and echo them. */ $class = join( ' ', $classes ); echo apply_filters( "{$hybrid->prefix}_comment_class", $class ); }
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> </div><!-- #comments-nav-above --> <?php endif; ?> <ol> <?php wp_list_comments('type=comment&callback=custom_comments'); ?>
/** * Displays the avatar for the comment author and wraps it in the comment author's URL if it is * available. Adds a call to HYBRID_IMAGES . "/{$comment_type}.png" for the default avatars for * trackbacks and pingbacks. * * @since 0.2.0 * @access public * @global $comment The current comment's DB object. * @global $hybrid The global Hybrid object. * @return void */ function hybrid_avatar() { global $comment, $hybrid; /* Make sure avatars are allowed before proceeding. */ if (!get_option('show_avatars')) { return false; } /* Get/set some comment variables. */ $comment_type = get_comment_type($comment->comment_ID); $author = get_comment_author($comment->comment_ID); $url = get_comment_author_url($comment->comment_ID); $avatar = ''; $default_avatar = ''; /* Get comment types that are allowed to have an avatar. */ $avatar_comment_types = apply_filters('get_avatar_comment_types', array('comment')); /* If comment type is in the allowed list, check if it's a pingback or trackback. */ if (in_array($comment_type, $avatar_comment_types)) { /* Set a default avatar for pingbacks and trackbacks. */ $default_avatar = 'pingback' == $comment_type || 'trackback' == $comment_type ? trailingslashit(HYBRID_IMAGES) . "{$comment_type}.png" : ''; /* Allow the default avatar to be filtered by comment type. */ $default_avatar = apply_filters("{$hybrid->prefix}_{$comment_type}_avatar", $default_avatar); } /* Set up the avatar size. */ $comment_list_args = hybrid_list_comments_args(); $size = $comment_list_args['avatar_size'] ? $comment_list_args['avatar_size'] : 80; /* Get the avatar provided by the get_avatar() function. */ $avatar = get_avatar($comment, absint($size), $default_avatar, $author); /* If URL input, wrap avatar in hyperlink. */ if (!empty($url) && !empty($avatar)) { $avatar = '<a href="' . esc_url($url) . '" rel="external nofollow" title="' . esc_attr($author) . '">' . $avatar . '</a>'; } /* Display the avatar and allow it to be filtered. Note: Use the get_avatar filter hook where possible. */ echo apply_filters("{$hybrid->prefix}_avatar", $avatar); }
?> </p> <?php return; } ?> <?php if ($comments || comments_open()) { /* Count the totals */ $numPingBacks = 0; $numComments = 0; $jquery = get_mystique_option('jquery'); /* Loop throught comments to count these totals */ foreach ($comments as $comment) { if (get_comment_type() != "comment") { $numPingBacks++; } else { $numComments++; } } if (get_mystique_option('post_single_related')) { // Related posts. Based on http://www.bin-co.com/blog/2009/04/show-related-post-in-wordpress-without-a-plugin/ $tags = wp_get_post_tags($post->ID); if ($tags) { $tag_ids = array(); foreach ($tags as $individual_tag) { $tag_ids[] = $individual_tag->term_id; } $args = array('tag__in' => $tag_ids, 'post__not_in' => array($post->ID), 'showposts' => 10, 'caller_get_posts' => 1); $backup = $post;
function wpgrade_comments($comment, $args, $depth) { static $comment_number; if (!isset($comment_number)) { $comment_number = $args['per_page'] * ($args['page'] - 1) + 1; } else { $comment_number++; } $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(); ?> > <article id="comment-<?php echo $comment->comment_ID; ?> " class="comment-article media"> <?php if (wpgrade::option('comments_show_numbering')) { ?> <span class="comment-number"><?php echo $comment_number; ?> </span> <?php } ?> <?php if (wpgrade::option('comments_show_avatar') && get_comment_type($comment->comment_ID) == 'comment') { ?> <aside class="comment__avatar media__img"> <!-- custom gravatar call --> <?php $bgauthemail = get_comment_author_email(); ?> <img src="http://www.gravatar.com/avatar/<?php echo md5($bgauthemail); ?> ?s=60" class="comment__avatar-image" height="60" width="60" style="background-image: <?php echo get_template_directory_uri() . '/library/images/nothing.gif'; ?> ; background-size: 100% 100%"/> </aside> <?php } ?> <div class="media__body"> <header class="comment__meta comment-author"> <?php printf('<span class="comment__author-name">%s</span>', get_comment_author_link()); ?> <time class="comment__time" datetime="<?php comment_time('c'); ?> "> <a href="<?php echo htmlspecialchars(get_comment_link($comment->comment_ID)); ?> " class="comment__timestamp"><?php printf(__('on %s at %s', 'rosa_txtd'), get_comment_date(), get_comment_time()); ?> </a> </time> <div class="comment__links"> <?php edit_comment_link(__('Edit', 'rosa_txtd'), ' ', ''); comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))); ?> </div> </header> <!-- .comment-meta --> <?php if ($comment->comment_approved == '0') { ?> <div class="alert info"> <p><?php _e('Your comment is awaiting moderation.', 'rosa_txtd'); ?> </p> </div> <?php } ?> <section class="comment__content comment"> <?php comment_text(); ?> </section> </div> </article> <!-- </li> is added by WordPress automatically --> <?php }
foreach ($comments as $comment) { ?> <li id="comment-<?php comment_ID(); ?> "> <cite <?php if ('comment' != get_comment_type()) { echo 'class="pingback"'; } ?> > <span class="author"> <?php comment_author_link(); if (function_exists("get_avatar") && 'comment' == get_comment_type()) { echo " " . get_avatar($comment, '40'); } ?> </span> <span class="date"> <?php comment_date($hemingwayEx->date_format() . '.y'); ?> / <?php comment_date('ga'); ?> </span> </cite> <div <?php if ($comment->comment_author_email == get_the_author_email()) {
<?php if (!empty($num_trackbacks)) { ?> <div id="trackbacks"> <h3><?php printf(_n('1 trackback', '%d trackbacks', $num_trackbacks, 'framemarket'), number_format_i18n($num_trackbacks)); ?> </h3> <ul id="trackbacklist"> <?php foreach ((array) $comments as $comment) { ?> <?php if ('comment' != get_comment_type()) { ?> <li> <h5><?php comment_author_link(); ?> </h5> <em>on <?php comment_date(); ?> </em> </li> <?php } ?>
function ttrust_comments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <li id="li-comment-<?php comment_ID(); ?> "> <div class="comment <?php echo get_comment_type(); ?> " id="comment-<?php comment_ID(); ?> "> <?php echo get_avatar($comment, '60', get_bloginfo('template_url') . '/images/default_avatar.png'); ?> <h5><?php comment_author_link(); ?> </h5> <span class="date"><?php comment_date(); ?> </span> <?php if ($comment->comment_approved == '0') { ?> <p><span class="message"><?php _e('Your comment is awaiting moderation.', 'themetrust'); ?> </span></p> <?php } ?> <?php comment_text(); ?> <?php if (get_comment_type() != "trackback") { comment_reply_link(array_merge($args, array('add_below' => 'comment', 'reply_text' => '<span>' . __('Reply', 'themetrust') . '</span>', 'login_text' => '<span>' . __('Log in to reply', 'themetrust') . '</span>', 'depth' => $depth, 'max_depth' => $args['max_depth']))); } ?> </div><!-- end comment --> <?php }
/** * Display the comment type of the current comment. * * @since 0.71 * * @param string $commenttxt Optional. String to display for comment type. Default false. * @param string $trackbacktxt Optional. String to display for trackback type. Default false. * @param string $pingbacktxt Optional. String to display for pingback type. Default false. */ function comment_type($commenttxt = false, $trackbacktxt = false, $pingbacktxt = false) { if (false === $commenttxt) { $commenttxt = _x('Comment', 'noun'); } if (false === $trackbacktxt) { $trackbacktxt = __('Trackback'); } if (false === $pingbacktxt) { $pingbacktxt = __('Pingback'); } $type = get_comment_type(); switch ($type) { case 'trackback': echo $trackbacktxt; break; case 'pingback': echo $pingbacktxt; break; default: echo $commenttxt; } }
/** * Comment wrapper attributes. * * @since 2.0.0 * @access public * @param array $attr * @return array */ function hybrid_attr_comment($attr) { $attr['id'] = 'comment-' . get_comment_ID(); $attr['class'] = join(' ', get_comment_class()); if (in_array(get_comment_type(), array('', 'comment'))) { $attr['itemprop'] = 'comment'; $attr['itemscope'] = 'itemscope'; $attr['itemtype'] = 'http://schema.org/UserComments'; } return $attr; }
?> <?php if (!comments_open() && !is_page()) { ?> <?php } // end ! comments_open() ?> <?php } // end have_comments() comment_form(); $pings_count = 0; foreach ($comments as $comment) { if (get_comment_type() != 'comment' && $comment->comment_approved != '0') { $pings_count = 1; break; } } if ($pings_count == 1) { ?> <h2 id="pings-title">Pingback & Trackback</h2> <ol class="pingslist"> <?php wp_list_comments('type=pings&callback=dotb_mytheme_comment'); ?> </ol> <?php }
/** * Sets a class for each comment * Sets alt, odd/even, and author/user classes * Adds author, user, and reader classes * * @since 0.2 */ function hybrid_comment_class() { global $comment; static $comment_alt; $classes = array(); if (function_exists('get_comment_class')) { $classes = get_comment_class(); } $classes[] = get_comment_type(); /* * User classes */ if ($comment->user_id > 0 && ($user = get_userdata($comment->user_id))) { $classes[] = 'user user-' . $user->user_nicename; if ($post = get_post($post_id)) { if ($comment->user_id === $post->post_author) { $classes[] = 'author author-' . $user->user_nicename; } } } else { $classes[] = 'reader'; } /* * Alt classes */ if ($comment_alt++ % 2) { $classes[] = 'even'; $classes[] = 'alt'; } else { $classes[] = 'odd'; } /* * http://microid.org */ $email = get_comment_author_email(); $url = get_comment_author_url(); if (!empty($email) && !empty($url)) { $microid = 'microid-mailto+http:sha1:' . sha1(sha1('mailto:' . $email) . sha1($url)); $classes[] = $microid; } $classes = join(' ', $classes); echo $classes; }
function comment_type($commenttxt = 'Comment', $trackbacktxt = 'Trackback', $pingbacktxt = 'Pingback') { $type = get_comment_type(); switch ($type) { case 'trackback': echo $trackbacktxt; break; case 'pingback': echo $pingbacktxt; break; default: echo $commenttxt; } }