function simplr_post_class($print = true)
{
    global $post, $simplr_post_alt;
    $c = array('hentry', "p{$simplr_post_alt}", $post->post_type, $post->post_status);
    $c[] = 'author-' . get_the_author_login();
    if (is_attachment()) {
        $c[] = 'attachment';
    }
    foreach ((array) get_the_category() as $cat) {
        $c[] = 'category-' . $cat->category_nicename;
    }
    simplr_date_classes(mysql2date('U', $post->post_date), $c);
    if (++$simplr_post_alt % 2) {
        $c[] = 'alt';
    }
    $c = join(' ', apply_filters('post_class', $c));
    return $print ? print $c : $c;
}
Example #2
0
function simplr_comment_class($print = true)
{
    global $comment, $post, $simplr_comment_alt;
    $c = array($comment->comment_type);
    if ($comment->user_id > 0) {
        $user = get_userdata($comment->user_id);
        $c[] = "byuser commentauthor-{$user->user_login}";
        if ($comment->user_id === $post->post_author) {
            $c[] = 'bypostauthor';
        }
    }
    simplr_date_classes(mysql2date('U', $comment->comment_date), $c, 'c-');
    if (++$simplr_comment_alt % 2) {
        $c[] = 'alt';
    }
    $c[] = "c{$simplr_comment_alt}";
    if (is_trackback()) {
        $c[] = 'trackback';
    }
    $c = join(' ', apply_filters('comment_class', $c));
    return $print ? print $c : $c;
}