Skip to content

Instantly share code, notes, and snippets.

@arielk
Last active September 3, 2015 12:13
Show Gist options
  • Save arielk/1250e4af1314cd68ea3c to your computer and use it in GitHub Desktop.
Save arielk/1250e4af1314cd68ea3c to your computer and use it in GitHub Desktop.
Pojo Themes with Jetpack Comments
<?php function pojo_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class( 'media' ); ?>>
<?php if ( 0 != $args['avatar_size'] ) : // Avatar ?>
<div class="pull-left">
<?php echo get_avatar( $comment, $args['avatar_size'] ); ?>
</div>
<?php endif; ?>
<div class="media-body">
<header class="comment-author vcard">
<?php echo '<cite class="fn">' . get_comment_author_link() . '</cite>'; ?>
<time datetime="<?php comment_date( 'c' ); ?>">
<a href="<?php echo esc_attr( get_comment_link( $comment->comment_ID ) ); ?>"><?php printf( __( '%1$s at %2$s', 'pojo' ), get_comment_date(), get_comment_time() ); ?></a>
</time>
<?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
<?php edit_comment_link( __( '(Edit)', 'pojo' ), '', '' ); ?>
</header>
<article id="comment-<?php comment_ID(); ?>">
<?php if ( $comment->comment_approved == '0' ) : ?>
<?php pojo_alert( __( 'Your comment is awaiting moderation.', 'pojo' ), false, false, 'block' ); ?>
<?php endif; ?>
<section class="comment">
<?php comment_text() ?>
</section>
</article><!-- #comment-ID -->
</div><!-- .media-body -->
</li><!-- .media -->
<?php } ?>
<?php if ( post_password_required() ) : ?>
<section id="comments">
<?php pojo_alert( __( 'This post is password protected. Enter the password to view comments.', 'pojo' ), false, false, 'block' ); ?>
</section><!-- /#comments -->
<?php
return;
endif; ?>
<?php if ( have_comments() ) : ?>
<section id="comments">
<h5 class="title-comments"><span><?php printf( _n( 'One Response', '%1$s Responses', get_comments_number(), 'pojo' ), number_format_i18n( get_comments_number() ), get_the_title() ); ?></span></h5>
<ol class="commentlist">
<?php wp_list_comments( array( 'callback' => 'pojo_comment', 'avatar_size' => 48 ) ); ?>
</ol>
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
<nav id="comments-nav" class="pager">
<div class="previous"><?php previous_comments_link( __( '&larr; Older comments', 'pojo' ) ); ?></div>
<div class="next"><?php next_comments_link( __( 'Newer comments &rarr;', 'pojo' ) ); ?></div>
</nav>
<?php endif; // check for comment navigation ?>
</section><!-- /#comments -->
<?php endif; ?>
<?php comment_form(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment