Created
September 27, 2018 10:26
-
-
Save zainaali/eeaa70ba74586b77f40352b501a9de57 to your computer and use it in GitHub Desktop.
Function for customize default design of comment template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Function for customize default design of comment template | |
function glowlogix_comment($comment, $args, $depth) { | |
if ( 'div' === $args['style'] ) { | |
$tag = 'div'; | |
$add_below = 'comment'; | |
} else { | |
$tag = 'li'; | |
$add_below = 'div-comment'; | |
} | |
?> | |
<?php if ( 'div' != $args['style'] ) : ?> | |
<?php endif; ?> | |
<li class="media"> | |
<div class="media-left"> | |
<a href="#"> | |
<?php if ( $args['avatar_size'] != 0 ) echo get_avatar( $comment, $args['avatar_size'], '', '', array('class' => 'media-object img-responsive') ); ?> | |
</a> | |
</div> | |
<?php if ( $comment->comment_approved == '0' ) : ?> | |
<em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.' ); ?></em> | |
<?php endif; ?> | |
<div class="media-body"> | |
<h6 class="media-heading"><?php comment_author(); ?><span> <?php comment_date('M d, Y'); ?> - <?php comment_time('g:i A'); ?></span></h6> | |
<?php comment_text(); ?> | |
<?php comment_reply_link( array_merge( $args, array( 'add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> | |
</div> | |
</li> | |
<?php if ( 'div' != $args['style'] ) : ?> | |
<?php endif; ?> | |
<?php | |
} | |
//call function in comment template | |
<?php | |
wp_list_comments( 'type=comment&callback=glowlogix_comment' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment