Last active
December 12, 2015 02:48
-
-
Save scottlyttle/4701389 to your computer and use it in GitHub Desktop.
Custom comments layout for a WordPress theme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place this in the comments.php theme file | |
<ol class="commentlist"> | |
<?php wp_list_comments('type=comment&callback=frankiewp_comment'); ?> | |
</ol> | |
// Place this in functions.php | |
function frankiewp_comment($comment, $args, $depth) { | |
$GLOBALS['comment'] = $comment; ?> | |
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>"> | |
<div id="comment-<?php comment_ID(); ?>"> | |
<div class="comment-author vcard"> | |
<?php echo get_avatar( $comment->comment_author_email, 48 ); ?> | |
<?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?> | |
</div> | |
<?php if ($comment->comment_approved == '0') : ?> | |
<em><?php _e('Your comment is awaiting moderation.') ?></em> | |
<br /> | |
<?php endif; ?> | |
<div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),' ','') ?></div> | |
<?php comment_text() ?> | |
<div class="reply"> | |
<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?> | |
</div> | |
</div> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment