Permalink
Browse files

comments

  • Loading branch information...
1 parent e405028 commit 6bbc684e0f52d4064def1b09d0231b70bb73ae98 @balexand committed Apr 13, 2012
Showing with 61 additions and 2 deletions.
  1. +55 −0 comments.php
  2. +3 −1 templates/page.php
  3. +3 −1 templates/single.php
View
@@ -0,0 +1,55 @@
+<?php
+
+// Render a comment </li> with the close tag omitted
+function theme_comment_callback($comment, $args, $depth) {
+ $GLOBALS['comment'] = $comment;
+ ?>
+ <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
+ <?php echo get_avatar( $comment, 50 ); ?>
+ <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>" class="comment_permalink comment_date"><?php printf('On %1$s at %2$s', get_comment_date(), get_comment_time() ); ?></a>
+ <?php printf( '%s <span class="says">said:</span>', sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?> <?php edit_comment_link('(Edit)', ' '); ?>
+ <div class="comment_body"><?php comment_text(); ?></div>
+
+ <div class="reply">
+ <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
+ </div>
+
+ <?php if ( $comment->comment_approved == '0' ) : ?>
+ <em class="comment-awaiting-moderation">Your comment is awaiting moderation.</em>
+ <br />
+ <?php endif; ?>
+ <?php
+}
+
+// Render a pingback </li> with the close tag omitted
+function themepingback_callback( $pingback, $args, $depth) {
+ $GLOBALS['comment'] = $pingback;
+ ?>
+ <li>
+ <?php comment_author_link(); ?><?php edit_comment_link('(Edit)', ' '); ?>
+ <?php
+}
+
+?>
+
+<div id="comments">
+ <?php if ( post_password_required() ) : ?>
+ <!-- Comments hidden for password protected posts -->
+ <?php elseif ( have_comments() ) : ?>
+
+ <h3 id="comments_title">Comments</h3>
+ <ol class="comments_list">
+ <?php wp_list_comments( array( 'callback' => 'theme_comment_callback', 'type' => 'comment' ) ); ?>
+ </ol>
+
+ <h3 id="pingbacks_title">Pingbacks</h3>
+ <ol class="pingbacks_list">
+ <?php wp_list_comments( array( 'callback' => 'theme_pingback_callback', 'type' => 'pings' ) ); ?>
+ </ol>
+
+ <?php elseif ( ! comments_open() && ! is_page() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
+ <p>Comments are closed.</p>
+ <?php endif; ?>
+
+ <?php comment_form(); ?>
+</div>
View
@@ -4,4 +4,6 @@
<?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?>
<?php the_content(); ?>
-</article>
+</article>
+
+<?php comments_template('', true); ?>
View
@@ -4,4 +4,6 @@
<?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?>
<?php the_content(); ?>
-</article>
+</article>
+
+<?php comments_template('', true); ?>

0 comments on commit 6bbc684

Please sign in to comment.