twentyeleven_comment

Template for comments and pingbacks.

Description

twentyeleven_comment( $comment, $args, $depth ); 

To override this walker in a child theme without modifying the comments template simply create your own twentyeleven_comment(), and that function will be used instead.

Used as a callback by wp_list_comments() for displaying the comments.

Parameters (3)

0. $comment
The comment.
1. $args
The args.
2. $depth
The depth.

Usage

  1. if ( !function_exists( 'twentyeleven_comment' ) ) { 
  2. require_once '/functions.php'; 
  3.  
  4. // The comment. 
  5. $comment = null; 
  6.  
  7. // The args. 
  8. $args = null; 
  9.  
  10. // The depth. 
  11. $depth = null; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = twentyeleven_comment($comment, $args, $depth); 
  15.  

Defined (1)

The function is defined in the following location(s).

/functions.php  
  1. function twentyeleven_comment( $comment, $args, $depth ) { 
  2. $GLOBALS['comment'] = $comment; 
  3. switch ( $comment->comment_type ) : 
  4. case 'pingback' : 
  5. case 'trackback' : 
  6. ?> 
  7. <li class="post pingback"> 
  8. <p><?php _e( 'Pingback:', 'twentyeleven' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?></p> 
  9. <?php 
  10. break; 
  11. default : 
  12. ?> 
  13. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>"> 
  14. <article id="comment-<?php comment_ID(); ?>" class="comment"> 
  15. <footer class="comment-meta"> 
  16. <div class="comment-author vcard"> 
  17. <?php 
  18. $avatar_size = 68; 
  19. if ( '0' != $comment->comment_parent ) 
  20. $avatar_size = 39; 
  21.  
  22. echo get_avatar( $comment, $avatar_size ); 
  23.  
  24. /** translators: 1: comment author, 2: date and time */ 
  25. printf( __( '%1$s on %2$s <span class="says">said:</span>', 'twentyeleven' ),  
  26. sprintf( '<span class="fn">%s</span>', get_comment_author_link() ),  
  27. sprintf( '<a href="%1$s"><time pubdate datetime="%2$s">%3$s</time></a>',  
  28. esc_url( get_comment_link( $comment->comment_ID ) ),  
  29. get_comment_time( 'c' ),  
  30. /** translators: 1: date, 2: time */ 
  31. sprintf( __( '%1$s at %2$s', 'twentyeleven' ), get_comment_date(), get_comment_time() ) 
  32. ); 
  33. ?> 
  34.  
  35. <?php edit_comment_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?> 
  36. </div><!-- .comment-author .vcard --> 
  37.  
  38. <?php if ( $comment->comment_approved == '0' ) : ?> 
  39. <em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'twentyeleven' ); ?></em> 
  40. <br /> 
  41. <?php endif; ?> 
  42.  
  43. </footer> 
  44.  
  45. <div class="comment-content"><?php comment_text(); ?></div> 
  46.  
  47. <div class="reply"> 
  48. <?php comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply <span>↓</span>', 'twentyeleven' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> 
  49. </div><!-- .reply --> 
  50. </article><!-- #comment-## --> 
  51.  
  52. <?php 
  53. break; 
  54. endswitch;