Ejemplo n.º 1
0
function k2_comment_class($comment_count = 1, $print = true)
{
    global $comment, $post;
    // Collects the comment type (comment, trackback),
    $c = array($comment->comment_type);
    // Counts trackbacks (t[n]) or comments (c[n])
    if ($comment->comment_type == 'trackback') {
        $c[] = "t{$comment_count}";
    } else {
        $c[] = "c{$comment_count}";
    }
    // If the comment author has an id (registered), then print the display name
    if ($comment->user_id > 0) {
        $user = get_userdata($comment->user_id);
        // For all registered users, 'byuser'; to specify the registered user, 'comment-author-[display_name]'
        $c[] = "byuser comment-author-" . sanitize_title_with_dashes(strtolower($user->display_name));
        // For comment authors who are the author of the post
        if ($comment->user_id === $post->post_author) {
            $c[] = 'bypostauthor';
        }
    }
    // If it's the other to the every, then add 'alt' class; collects time- and date-based classes
    k2_date_classes(mysql2date('U', $comment->comment_date), $c, 'c-');
    if ($comment_count & 1 == 1) {
        $c[] = 'alt';
    }
    // Separates classes with a single space, collates classes for comment LI
    $c = join(' ', apply_filters('comment_class', $c));
    // Tada again!
    return $print ? print $c : $c;
}
Ejemplo n.º 2
0
function k2_comment_class_filter($classes)
{
    global $comment;
    k2_date_classes(mysql2date('U', $comment->comment_date), $classes, 'c-');
    return $classes;
}