Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 128 lines (107 sloc) 4.739 kB
446933c @randyjensen first commit
authored
1 <?php
2 /**
3 * @package WordPress
4 * @subpackage themename
5 */
6
89f2341 @randyjensen updated some toolbox references
authored
7 if ( ! function_exists( 'handcraftedwp_comment' ) ) :
446933c @randyjensen first commit
authored
8 /**
9 * Template for comments and pingbacks.
10 *
11 * To override this walker in a child theme without modifying the comments template
89f2341 @randyjensen updated some toolbox references
authored
12 * simply create your own handcraftedwp_comment(), and that function will be used instead.
446933c @randyjensen first commit
authored
13 *
14 * Used as a callback by wp_list_comments() for displaying the comments.
15 *
89f2341 @randyjensen updated some toolbox references
authored
16 * @since HandcraftedWP 0.4
446933c @randyjensen first commit
authored
17 */
89f2341 @randyjensen updated some toolbox references
authored
18 function handcraftedwp_comment( $comment, $args, $depth ) {
446933c @randyjensen first commit
authored
19 $GLOBALS['comment'] = $comment;
20 switch ( $comment->comment_type ) :
21 case '' :
22 ?>
23 <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
24 <article id="comment-<?php comment_ID(); ?>" class="comment" role="article">
25 <footer>
26 <div class="comment-author vcard">
27 <?php echo get_avatar( $comment, 40 ); ?>
28 <?php printf( __( '%s <span class="says">says:</span>', 'themename' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
29 </div><!-- .comment-author .vcard -->
30 <?php if ( $comment->comment_approved == '0' ) : ?>
31 <em><?php _e( 'Your comment is awaiting moderation.', 'themename' ); ?></em>
32 <br />
33 <?php endif; ?>
34
35 <div class="comment-meta commentmetadata">
36 <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>"><time pubdate datetime="<?php comment_time( 'c' ); ?>">
37 <?php
38 /* translators: 1: date, 2: time */
39 printf( __( '%1$s at %2$s', 'themename' ), get_comment_date(), get_comment_time() ); ?>
40 </time></a>
41 <?php edit_comment_link( __( '(Edit)', 'themename' ), ' ' );
42 ?>
43 </div><!-- .comment-meta .commentmetadata -->
44 </footer>
45
46 <div class="comment-body"><?php comment_text(); ?></div>
47
48 <div class="reply">
49 <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
50 </div><!-- .reply -->
51 </article><!-- #comment-## -->
52
53 <?php
54 break;
55 case 'pingback' :
56 case 'trackback' :
57 ?>
58 <li class="post pingback">
59 <p><?php _e( 'Pingback:', 'themename' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __('(Edit)', 'themename'), ' ' ); ?></p>
60 <?php
61 break;
62 endswitch;
63 }
89f2341 @randyjensen updated some toolbox references
authored
64 endif; // ends check for handcraftedwp_comment()
446933c @randyjensen first commit
authored
65
66 ?>
67
68 <div id="comments">
69 <?php if ( post_password_required() ) : ?>
70 <div class="nopassword"><?php _e( 'This post is password protected. Enter the password to view any comments.', 'themename' ); ?></div>
71 </div><!-- .comments -->
72 <?php return;
73 endif;
74 ?>
75
76 <?php // You can start editing here -- including this comment! ?>
77
78 <?php if ( have_comments() ) : ?>
79 <h2 id="comments-title">
80 <?php
81 printf( _n( 'One Response to %2$s', '%1$s Responses to %2$s', get_comments_number(), 'themename' ),
82 number_format_i18n( get_comments_number() ), '<em>' . get_the_title() . '</em>' );
83 ?>
84 </h2>
85
86 <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
87 <nav id="comment-nav-above" role="article">
88 <h1 class="section-heading"><?php _e( 'Comment navigation', 'themename' ); ?></h1>
89 <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'themename' ) ); ?></div>
90 <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'themename' ) ); ?></div>
91 </nav>
92 <?php endif; // check for comment navigation ?>
93
94 <ol class="commentlist">
89f2341 @randyjensen updated some toolbox references
authored
95 <?php wp_list_comments( array( 'callback' => 'handcraftedwp_comment' ) ); ?>
446933c @randyjensen first commit
authored
96 </ol>
97
98 <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
99 <nav id="comment-nav-below" role="article">
100 <h1 class="section-heading"><?php _e( 'Comment navigation', 'themename' ); ?></h1>
101 <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'themename' ) ); ?></div>
102 <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'themename' ) ); ?></div>
103 </nav>
104 <?php endif; // check for comment navigation ?>
105
106 <?php else : // this is displayed if there are no comments so far ?>
107
108 <?php if ( comments_open() ) : // If comments are open, but there are no comments ?>
109
110 <?php else : // or, if we don't have comments:
111
112 /* If there are no comments and comments are closed,
113 * let's leave a little note, shall we?
114 * But only on posts! We don't really need the note on pages.
115 */
116 if ( ! comments_open() && ! is_page() ) :
117 ?>
118 <p class="nocomments"><?php _e( 'Comments are closed.', 'themename' ); ?></p>
119 <?php endif; // end ! comments_open() && ! is_page() ?>
120
121
122 <?php endif; ?>
123
124 <?php endif; ?>
125
126 <?php comment_form(); ?>
127
128 </div><!-- #comments -->
Something went wrong with that request. Please try again.