-
-
Save anonymous/cd09078d875b4b23ddb6 to your computer and use it in GitHub Desktop.
comments.php
This file contains 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
<?php | |
// comment design | |
function wpi_theme_comment($comment, $args, $depth) { | |
$GLOBALS['comment'] = $comment; | |
$com_id = get_comment_ID(); | |
$com_like = get_comment_meta($com_id, 'like', true); | |
$com_dislike = get_comment_meta($com_id, 'dislike', true); | |
?> | |
<li <?php comment_class(); ?> id="comment-<?php echo $com_id; ?>"> | |
<?php | |
if ($comment->user_id == get_the_author_meta('ID')) { | |
$author = ' comments-author'; | |
} else { | |
$author=''; | |
} ?> | |
<div class="comments-item<?php echo $author; ?>"> | |
<div class="avatar-image-container"> | |
<?php if (get_comment_author_url()) : ?> | |
<a href="<?php echo comment_author_url(); ?>" target="_blank" rel="nofollow"> | |
<?php echo get_avatar( $comment, 45, null, 'comment-avatar');?> | |
</a> | |
<?php else: ?> | |
<span><?php echo get_avatar( $comment, 45, null, 'comment-avatar');?></span> | |
<?php endif; ?> | |
</div> | |
<div class="comment-block"> | |
<div class="comment-arrow sprites"></div> | |
<div class="comments-inner"> | |
<div class="comment-author-name"><?php echo comment_author_link(); ?></div> | |
<div class="comment-content"> | |
<?php comment_text(); ?> | |
<div class="clear"></div> | |
<?php if ($comment->comment_approved == '0') : ?> | |
<p><em><?php printf ( __wpi( 'Your comment is awaiting moderation.' ));?></em></p> | |
<?php endif; ?> | |
</div> | |
<div class="comment-meta"> | |
<span class="comment-likes secondary-text"> | |
<?php | |
if ($com_like) { | |
echo '<span class="count">' . $com_like . '</span> '; | |
$com_like = (int) $com_like; | |
if ($com_like >= 2) { | |
echo __wpi('likes'); | |
} else { | |
echo __wpi('like'); | |
} | |
echo ' . '; | |
} else { | |
echo '<span class="count" title="'. __wpi('like').'___'.__wpi('likes').'"></span>'; | |
} | |
?> | |
<a href="#like-<?php echo $com_id; ?>" title="<?php echo __wpi('Click to like this comment');?>"> | |
<?php echo __wpi('Like'); ?> | |
</a> <span class="comma">.</span> | |
</span> | |
<span class="comment-dislikes secondary-text"> | |
<?php | |
if ($com_dislike) { | |
echo '<span class="count">' . $com_dislike . '</span> '; | |
$com_dislike = (int) $com_dislike; | |
if ($com_dislike >= 2) { | |
echo __wpi('dislikes'); | |
} else { | |
echo __wpi('dislike'); | |
} | |
echo ' . '; | |
} else { | |
echo '<span class="count" title="'. __wpi('dislike').'___'.__wpi('dislikes').'"></span>'; | |
} | |
?> | |
<a href="#dislike-<?php echo $com_id; ?>" title="<?php echo __wpi('Click to dislike this comment');?>"> | |
<?php echo __wpi('Dislike'); ?> | |
</a> <span class="comma">.</span> | |
</span> | |
<span class="datetime secondary-text"> | |
<a href="<?php echo get_comment_link(); ?>" rel="nofollow" title="<?php echo __wpi('Permalink'); ?>"><?php printf(' %1$s, %2$s', get_comment_date(), get_comment_time());?></a> . | |
</span> | |
<span class="comment-actions secondary-text"> | |
<?php | |
comment_reply_link( wp_parse_args( $args, array( 'reply_text' => __wpi( 'Reply' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> | |
</span> | |
</div> | |
</div> | |
</div> | |
</div> | |
<div class="clear"></div> | |
<?php | |
} | |
/* | |
* If the current post is protected by a password and the visitor has not yet | |
* entered the password we will return early without loading the comments. | |
*/ | |
if ( post_password_required() ) { | |
return; | |
} | |
if ( have_comments()) { | |
?> | |
<div id="comments" class="comments post-footer-box noborder"> | |
<h3 class="sub-title"><?php | |
global $number_of_comment; | |
echo $number_of_comment . ' '; | |
if ((int) $number_of_comment < 2) { | |
echo __wpi('comment'); | |
} else { | |
echo __wpi('comments'); | |
} | |
?></h3> | |
<div class="clear"></div> | |
<ol class="comment-list"> | |
<?php | |
wp_list_comments( array( 'callback' => 'wpi_theme_comment' ) ); | |
?> | |
</ol> | |
</div> | |
<?php | |
// Are there comments to navigate through? | |
if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : | |
?> | |
<nav class="navigation comment-navigation" role="navigation"> | |
<h3 class="screen-reader-text section-heading"><?php echo __wpi( 'Comment navigation' ); ?></h3> | |
<div class="nav-previous"><?php previous_comments_link( '← ' . __wpi( 'Older Comments' ) ); ?></div> | |
<div class="nav-next"><?php next_comments_link( __wpi( 'Newer Comments' ) . ' →' ); ?></div> | |
</nav><!-- .comment-navigation --> | |
<?php endif; // Check for comment navigation ?> | |
<?php if ( ! comments_open() && get_comments_number() ) : ?> | |
<p class="no-comments"><?php echo __wpi( 'Comments are closed.' ); ?></p> | |
<?php endif; ?> | |
<?php | |
} | |
if ( comments_open() ) { | |
// comment form | |
$required_text = ''; | |
$aria_req = ''; | |
$args = array( | |
'id_form' => 'commentform', | |
'id_submit' => 'submit', | |
'title_reply' => __wpi( 'Leave a Reply' ), | |
'title_reply_to' => (__wpi( 'Leave a Reply to').'%s'), | |
'cancel_reply_link' => __wpi( 'Cancel Reply' ), | |
'label_submit' => __wpi( 'Post Comment' ), | |
'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __wpi( 'Comment' ) . | |
'</label><textarea id="comment" name="comment" cols="45" rows="5" aria-required="true">' . | |
'</textarea></p>', | |
'must_log_in' => '<p class="must-log-in">' . | |
sprintf( | |
__wpi('You must be') . ' <a href="%s">' . __wpi('logged in') . '</a> ' . __wpi('to post a comment'), | |
wp_login_url( apply_filters( 'the_permalink', get_permalink() ) ) | |
) . '</p>', | |
'logged_in_as' => '<div class="comment-form-avatar">'.get_avatar(wp_get_current_user()->user_email, 45, null, 'comment-avatar').'</div> | |
<div class="comment-form-arrow sprites"></div> | |
<div class="comment-form-inner"><p class="logged-in-as">' . | |
sprintf( | |
__wpi( 'Logged in as'). ' <a href="%1$s">%2$s</a>. <a href="%3$s" title="' .__wpi('Log out of this account').'">'.__wpi('Log out?'). '</a>' , | |
admin_url( 'profile.php' ), | |
$user_identity, | |
wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) ) | |
) . '</p>', | |
'comment_notes_before' => ' | |
<div class="comment-form-avatar">'.get_avatar(esc_attr( $commenter['comment_author_email'] ), 45, null, 'comment-avatar').'</div> | |
<div class="comment-form-arrow sprites"></div> | |
<div class="comment-form-inner"> | |
', | |
/* | |
'comment_notes_before' => '<p class="comment-notes">' . | |
__wpi( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . | |
'</p>', | |
*/ | |
'comment_notes_after' => '<div class="clear"></div></div>', | |
/* | |
'comment_notes_after' => '<p class="form-allowed-tags">' . | |
sprintf( | |
__( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s' ), | |
' <code>' . allowed_tags() . '</code>' | |
) . '</p>', | |
*/ | |
'fields' => apply_filters( 'comment_form_default_fields', array( | |
'author' => | |
'<p class="comment-form-author">' . | |
'<label for="author">' . __wpi( 'Name' ) . '</label> ' . | |
( $req ? '<span class="required">*</span>' : '' ) . | |
'<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . | |
'" ' . $aria_req . ' /></p>', | |
'email' => | |
'<p class="comment-form-email"><label for="email">' . __wpi( 'Email' ) . '</label> ' . | |
( $req ? '<span class="required">*</span>' : '' ) . | |
'<input id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . | |
'" ' . $aria_req . ' /></p>', | |
'url' => | |
'<p class="comment-form-url"><label for="url">' . | |
__wpi( 'Website' ) . '</label>' . | |
'<input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . | |
'" /></p>' | |
) | |
), | |
); | |
comment_form($args); | |
} | |
?> | |
<div class="clear"></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment