class custom_walker_comment extends Walker_Comment {
var $tree_type = 'comment';
var $db_fields = array( 'parent' => 'comment_parent', 'id' => 'comment_ID' );
function __construct() {
echo '<ul id="comment-list">';
}
function start_lvl( &$output, $depth = 0, $args = array() ) {
$GLOBALS['comment_depth'] = $depth + 1;
echo '<ul class="children">';
}
function end_lvl( &$output, $depth = 0, $args = array() ) {
$GLOBALS['comment_depth'] = $depth + 1;
echo '</ul><!-- /.children -->';
}
/** START_EL */
function start_el( &$output, $comment, $depth, $args, $id = 0 ) {
$depth++;
$GLOBALS['comment_depth'] = $depth;
$GLOBALS['comment'] = $comment;
$parent_class = ( empty( $args['has_children'] ) ? '' : 'parent' );
?>
<section class="mb-md">
<h1><?php echo get_the_title($comment->comment_post_ID);?></h1>
<p class="mt-sm"><small>By <?php $comment_user = get_userdata($comment->user_id);
echo $comment_user->first_name." ".$comment_user->last_name;?></small></p>
<p class="mt-sm">
<?php if( !$comment->comment_approved ) : ?><em class="comment-awaiting-moderation">Your comment is awaiting moderation.</em>
<?php
else: comment_text();
endif;
?>
</p>
<p><time><?php comment_date(); ?></time></p>
</section>
<?php
}
function end_el(&$output, $comment, $depth = 0, $args = array() ) {
echo '</li><!-- /#comment-' . get_comment_ID() . ' -->';
}
function __destruct() {
echo '</ul><!-- /#comment-list -->';
}
}