abdelhadi-h
10/18/2017 - 11:03 PM

WP - Comments

<?php
//Get All comments on this post 
$args = array(
    'status' => 'approve',
    'post_id' => get_the_ID()
);
 
// The comment Query
 
$comments_query = new WP_Comment_Query;
$comments = $comments_query->query( $args );

// Comment Loop
if ( $comments ) { ?>
   				<ol class="commentlist clearfix">
							<?php foreach ( $comments as $comment ): ?>
								<li class="comment even thread-even depth-1" id="li-comment-1">
									<div id="<?php echo $comment->comment_ID; ?>" class="comment-wrap clearfix">
										<div class="comment-meta">
											<div class="comment-author vcard">
												<span class="comment-avatar clearfix">
												<img alt="" src="http://0.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=60" class="avatar avatar-60 photo avatar-default" height="60" width="60"></span>
											</div>
										</div>
										<div class="comment-content clearfix">
											<div class="comment-author"> <?php echo $comment->comment_author; ?>
												<span><?php echo $comment->comment_date_gmt ; ?></span>
											</div>
											<p><?php echo $comment->comment_content; ?></p>
										</div>
										<div class="clear"></div>
									</div>
								</li>
							<?php endforeach; ?>
							</ol><!-- .commentlist end -->
<?php
    } else {
    echo 'No comments .';
}
?>

<?php
//Comment Form
$fields =  array(
  'author' =>  '<div class="col_one_third">
				<label for="author">'.__('Name','woblog').' (*)</label>
				<input type="text" id="author" name="author" value="" 
				size="22" tabindex="1" class="sm-form-control" required></div>',
  'email' => '<div class="col_one_third">
				    <label for="email">Email (*)</label>
				    <input id="email" name="email" type="text" value="" size="22" tabindex="2" class="sm-form-control" required >
			    </div>',
  'url' => '<div class="col_one_third col_last">
										<label for="url">Website</label>
										<input id="url" name="url" type="text" value="" size="22" tabindex="3" class="sm-form-control" >
			</div>'
);
$comment_field = '<div class="col_full">
										<label for="comment">'.__('Comment','woblog').'</label>
										<textarea id="comment" name="comment" cols="58" rows="7" tabindex="4" class="sm-form-control" aria-required="true" required /></textarea>
									</div>';

$args_com_form = array('fields' => $fields , 
                       'comment_field' => $comment_field,
                        'class_submit' => 'button button-3d nomargin');
?>
	<div id="respond" class="clearfix">
    <?php
      comment_form( $args_com_form);
    ?>
  </div>
  
  <?php
  //Display comments
  comments_template();
  ?>