Skip to content

Instantly share code, notes, and snippets.

@dancingsoda
Created December 7, 2016 04:17
Show Gist options
  • Save dancingsoda/d0d248726661f01bbb8074da7c68a76b to your computer and use it in GitHub Desktop.
Save dancingsoda/d0d248726661f01bbb8074da7c68a76b to your computer and use it in GitHub Desktop.
replace the old code
<?php
/**
* The template for displaying comments.
*
* This is the template that displays the area of the page that contains both the current comments
* and the comment form.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package DAHZ Framework
*/
/*
* 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;
}
// You can start editing here -- including this comment!
if ( have_comments() ) :
if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through?
?>
<div class="de-single__comments-area-pagination">
<div class="de-single__comments-area-pagination-prev">
<?php
previous_comments_link( '
<svg class="de-svg de-to-svg" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
<foreignobject><div class="de-svg-bg de-left-arrow-svg"></div></foreignobject>
<g><g><g><rect x="0.266" y="11.623" width="23.734" height="0.753"/></g></g><g><polygon points="3.391,8.343 3.923,8.876 0.799,12 3.923,15.124 3.391,15.657 0,12.266 0,11.734" /></g></g>
</svg>
'.esc_html__('Older Comments','glossy').'' );
?>
</div>
<div class="de-single__comments-area-pagination-next">
<?php
next_comments_link( '
'.esc_html__('Newer Comments','glossy').'
<svg class="de-svg de-to-svg" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
<foreignobject><div class="de-svg-bg de-right-arrow-svg"></div></foreignobject>
<g><g><g><rect y="11.623" width="23.734" height="0.753"/></g></g><g><polygon points="20.609,15.657 20.077,15.124 23.201,12 20.077,8.876 20.609,8.343 24,11.734 24,12.266" /></g></g>
</svg>' );
?>
</div>
</div>
<?php
endif; // Check for comment navigation.
?>
<ul>
<?php
$dv_comment_args = array(
'callback' => 'dahz_framework_comment_template',
'style' => 'ul',
);
wp_list_comments( $dv_comment_args );
?>
</ul>
<?php
if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through?
?>
<div class="de-single__comments-area-pagination">
<div class="de-single__comments-area-pagination-prev">
<?php
previous_comments_link( '
<svg class="de-svg de-to-svg" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
<foreignobject><div class="de-svg-bg de-left-arrow-svg"></div></foreignobject>
<g><g><g><rect x="0.266" y="11.623" width="23.734" height="0.753"/></g></g><g><polygon points="3.391,8.343 3.923,8.876 0.799,12 3.923,15.124 3.391,15.657 0,12.266 0,11.734" /></g></g>
</svg>
'.esc_html__('Older Comments','glossy').'');
?>
</div>
<div class="de-single__comments-area-pagination-next">
<?php
next_comments_link( '
'.esc_html__('Newer Comments','glossy').'
<svg class="de-svg de-to-svg" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
<foreignobject><div class="de-svg-bg de-right-arrow-svg"></div></foreignobject>
<g><g><g><rect y="11.623" width="23.734" height="0.753"/></g></g><g><polygon points="20.609,15.657 20.077,15.124 23.201,12 20.077,8.876 20.609,8.343 24,11.734 24,12.266" /></g></g>
</svg>' );
?>
</div>
</div>
<?php
endif; // Check for comment navigation.
endif; // Check for have_comments().
// If comments are closed and there are comments, let's leave a little note, shall we?
if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
?>
<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'glossy' ); ?></p>
<?php
endif;
$commenter = wp_get_current_commenter();
$req = get_option( 'require_name_email' );
$aria_req = ( $req ? " aria-required='true'" : '' );
$args_comment = array(
'class_form' => 'comment-form',
'comment_notes_before' => '<p class="reply-description">'.esc_html__('Your email address will not be published. Required fields are marked *','glossy').'</p><div class="comment-form-input">',
'comment_notes_after' => '',
'logged_in_as' => '<p class="logged-in-as">' . sprintf( '%4$s <a href="%1$s">%2$s</a>.
<a href="%3$s" title="%5$s"> %6$s </a>',
admin_url( 'profile.php' ),
$user_identity,
wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) ),
esc_html__( 'Logged in as' , 'glossy' ),
esc_attr__( 'Log out of this account' , 'glossy' ),
esc_html__( 'Log out?' , 'glossy' )
) . '</p>
<div class="comment-form-input">',
'comment_field' => '<textarea name="comment" id="comment" cols="106" rows="10" placeholder="' . esc_attr__('YOUR MESSAGE', 'glossy').'"></textarea>',
'fields' => apply_filters( 'comment_form_default_fields', array(
'author' => '<ul class="comment-form-info">
<li class="comment-author">
<input type="text" id="author" name="author" value="' . esc_attr( $commenter['comment_author'] ) .'" '.$aria_req.' placeholder="'.esc_attr__('NAME *','glossy').'" />
</li><!--',
'email' => '--><li class="comment-email">
<input type="text" id="email" name="email" value="' . esc_attr( $commenter['comment_author_email'] ) . '" '.$aria_req.' placeholder="'.esc_attr__('EMAIL *','glossy').'" />
</li><!--',
'url' => '--><li class="comment-website">
<input type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" aria-required="true" placeholder="'.esc_attr__('WEBSITE','glossy').'" />
</li></ul>'
)
),
'title_reply_before' => '<ul class="de-single__comments-area-reply de-inline-list">
<li class="reply-title"><h5>',
'title_reply_after' => '</h5></li></ul>',
'label_submit' => esc_html__('SUBMIT','glossy'),
'class_submit' => 'comment-submit',
'submit_field' => '</div><h6 class="de-btn de-btn__background">%1$s %2$s</h6>',
'cancel_reply_link' => '<span class="reply-cancel">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path d="M23.954 21.03l-9.184-9.095 9.092-9.174-2.832-2.807-9.09 9.179-9.176-9.088-2.81 2.81 9.186 9.105-9.095 9.184 2.81 2.81 9.112-9.192 9.18 9.1z"/>
</svg>
</span>'
);
comment_form( $args_comment );
function dahz_framework_comment_template( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) {
case 'pingback':
case 'trackback':
?>
<li <?php comment_class(); ?> id="comment<?php comment_ID(); ?>">
<div class="back-link"><?php comment_author_link(); ?></div>
<?php
break;
default:
?>
<li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
<div <?php comment_class('de-single__comments-area-item');?> >
<div class="comments-avatar">
<?php echo get_avatar( $comment, 100, '', 'avatar', array( 'class' => '' ) );?>
</div>
<div class="comments-post">
<div class="vcard">
<h5 class="author"><?php comment_author();?></h5>
</div>
<div class="comments">
<?php comment_text();?>
</div>
<div class="comments-footer">
<ul class="de-inline-list">
<li><span class="post-date"><?php comment_date();?></span></li>
<li class="comments-button">
<span id="show-input">
<?php
comment_reply_link( array_merge( $args,
array(
'reply_text' => '<h6>' . esc_html__('Reply', 'glossy') . '</h6>',
'depth' => $depth,
'max_depth' => $args['max_depth']
)
)
);
?>
</span>
</li>
</ul>
</div>
</div>
</div>
<?php // End the default styling of comment
break;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment