Skip to content

Instantly share code, notes, and snippets.

@asiermarques
Last active September 26, 2016 10:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asiermarques/2c30d277405b3693b5a211a5a504c983 to your computer and use it in GitHub Desktop.
Save asiermarques/2c30d277405b3693b5a211a5a504c983 to your computer and use it in GitHub Desktop.
WordPress Comments Layout with Bootstrap
<?php
function wp_bootstrap_comments($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?>>
<article id="comment-<?php comment_ID(); ?>" class="clearfix">
<div class="comment-author vcard clearfix">
<div class="avatar col-sm-3">
<?php echo get_avatar( $comment, $size='75' ); ?>
</div>
<div class="col-sm-9 comment-text">
<?php printf('<h4>%s</h4>', get_comment_author_link()) ?>
<?php edit_comment_link(__('Edit','wpbootstrap'),'<span class="edit-comment btn btn-sm btn-info"><i class="glyphicon-white glyphicon-pencil"></i>','</span>') ?>
<?php if ($comment->comment_approved == '0') : ?>
<div class="alert-message success">
<p><?php _e('Your comment is awaiting moderation.','wpbootstrap') ?></p>
</div>
<?php endif; ?>
<?php comment_text() ?>
<time datetime="<?php echo comment_time('Y-m-j'); ?>"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php comment_time('F jS, Y'); ?> </a></time>
<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
</div>
</div>
</article>
</li>
<?php
}
function list_pings($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment;
?>
<li id="comment-<?php comment_ID(); ?>"><i class="icon icon-share-alt"></i>&nbsp;<?php comment_author_link(); ?>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment