bre_comment

Template for comments and pingbacks.

Description

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

To override this walker in a child theme without modifying the comments template simply create your own bre_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( 'bre_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 = bre_comment($comment, $args, $depth); 
  15.  

Defined (1)

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

/functions.php  
  1. function bre_comment( $comment, $args, $depth ) { 
  2. $GLOBALS['comment'] = $comment; 
  3. switch ( $comment->comment_type ) : 
  4. case 'pingback' : 
  5. case 'trackback' : 
  6. // Display trackbacks differently than normal comments. 
  7. ?> 
  8. <li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>"> 
  9. <p><?php _e( 'Pingback:', 'bre-bootstrap-ecommerce' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( '(Edit)', 'bre-bootstrap-ecommerce' ), '<span class="edit-link">', '</span>' ); ?></p> 
  10. <?php 
  11. break; 
  12. default : 
  13. // Proceed with normal comments. 
  14. global $post; 
  15. ?> 
  16. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>"> 
  17. <article id="comment-<?php comment_ID(); ?>" class="comment"> 
  18. <header class="comment-meta comment-author vcard"> 
  19. <?php 
  20. echo get_avatar( $comment, 44 ); 
  21. printf( '<cite class="fn">%1$s %2$s</cite>',  
  22. get_comment_author_link(),  
  23. // If current post author is also comment author, make it known visually. 
  24. ( $comment->user_id === $post->post_author ) ? '<span> ' . __( 'Post author', 'bre-bootstrap-ecommerce' ) . '</span>' : '' 
  25. ); 
  26. printf( '<a href="%1$s"><time datetime="%2$s">%3$s</time></a>',  
  27. esc_url( get_comment_link( $comment->comment_ID ) ),  
  28. get_comment_time( 'c' ),  
  29. /** translators: 1: date, 2: time */ 
  30. sprintf( __( '%1$s at %2$s', 'bre-bootstrap-ecommerce' ), get_comment_date(), get_comment_time() ) 
  31. ); 
  32. ?> 
  33. </header><!-- .comment-meta --> 
  34.  
  35. <?php if ( '0' == $comment->comment_approved ) : ?> 
  36. <p class="comment-awaiting-moderation alert alert-info"><?php _e( 'Your comment is awaiting moderation.', 'bre-bootstrap-ecommerce' ); ?></p> 
  37. <?php endif; ?> 
  38.  
  39. <section class="comment-content comment"> 
  40. <?php comment_text(); ?> 
  41. <?php edit_comment_link( __( 'Edit', 'bre-bootstrap-ecommerce' ), '<p class="edit-link btn btn-mini">', '</p>' ); ?> 
  42. </section><!-- .comment-content --> 
  43.  
  44. <div class="reply"> 
  45. <?php comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply', 'bre-bootstrap-ecommerce' ), 'after' => ' <span>↓</span>', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> 
  46. </div><!-- .reply --> 
  47. </article><!-- #comment-## --> 
  48. <?php 
  49. break; 
  50. endswitch; // end comment_type check