';
// Navigation.
echo
tag_pagination_comments( array( 'id' => 'comment-nav-above' ) );
// Recursive callback to display all comments.
echo
'';
wp_list_comments( array( 'callback' => 'bpq\display_comment' ) );
echo
'';
// Navigation.
echo
tag_pagination_comments( array( 'id' => 'comment-nav-below' ) );
}
// If comments are closed and there are comments, let's leave a little note, shall we?
if ( !comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) )
{
echo
'
'.
__( 'Comments are closed.', 'bpq' ).
'
';
}
// WP provides a function to display the reply area in the comments section - comment_form().
// This particular function has a ton of arguments that can be passed - fill it out and call it.
//
// @link http://codex.wordpress.org/Function_Reference/comment_form
$commenter = wp_get_current_commenter();
$req = get_option( 'require_name_email' );
$aria_req = $req ? ' aria-required="true"' : '';
$comments_args = array(
'fields' =>
array(
'author' =>
' '.
''.
'
',
'comment_notes_after' =>
'',
'id_submit' =>
'comment-submit',
'label_submit' =>
__( 'Post your comment', 'bpq' ),
'title_reply' =>
__( 'Reply with a comment', 'bpq' ),
'title_reply_to' =>
__( 'Reply with a comment to %s', 'bpq' )
);
comment_form( $comments_args );
// And end the whole comment area.
echo
'
'.
'
'.
'
'.
'';
/**
* This is a callback for wp_list_comments(). It provides a single comment at a time.
*
* Note: The parameters are defined by WP, do not change them.
*
* @link http://themeshaper.com/2012/11/04/the-wordpress-theme-comments-template/
* @param string $comment
* @param integer $depth
* @param array $args
* @return string The markup
*/
function display_comment( $comment, $args, $depth )
{
// Save the comment in a static area.
$GLOBALS['comment'] = $comment;
// The markup.
ob_start();
switch ( $comment->comment_type )
{
// Ping and trackbacks get special consideration.
case 'pingback':
case 'trackback':
echo
'
'.
''.
''.
__( 'Pingback: ', 'bpq' );
comment_author_link();
echo
'';
// Note: It is intentional to leave off the ending
break;
// The comment case.
default:
echo
'
';
if ( $comment->comment_approved == '0' )
{
echo
'
'.
__( 'Your comment is awaiting moderation.', 'bpq' ).
'