Created
March 6, 2019 13:59
-
-
Save txid0x7f/62d0699934328b8bd731dedb54f56b41 to your computer and use it in GitHub Desktop.
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
<div class="comments wrapper"> | |
<h4 class="comments__title">Leave a Comment</h4> | |
<ul class="comments__list"> | |
<?php | |
$comments_args = array( | |
'hierarchical' => 'threaded', | |
); | |
$comments = get_comments($comments_args); | |
foreach ($comments as $comment) { ?> | |
<li class="comments__item"> | |
<div class="comment" id="comment-<?php echo $comment->comment_ID; ?>"> | |
<?php echo get_avatar($comment->comment_ID, 80, '', '', array('class' => 'comment__avatar')); ?> | |
<div class="comment__meta"> | |
<h5 class="comment__name"><?php echo $comment->comment_author; ?></h5> | |
<div class="comment__time"><?php comment_time('F j, Y \a\t H:i a'); ?></div> | |
</div> | |
<div class="comment__content"> | |
<div class="comment__bubble"> | |
<?php echo $comment->comment_content; ?> | |
</div> | |
<div class="comment__control"> | |
<?php | |
$link = get_comment_reply_link(array( | |
'reply_text' => "Comment Reply", | |
'respond_id' => 'comment-' . $comment->comment_ID, | |
'depth' => 1, | |
'max_depth' => 10, | |
), 2881, 631); | |
echo $link; ?> | |
</div> | |
</div> | |
</div> | |
<?php | |
$parent_comments_args = array( | |
'parent' => $comment->comment_ID, | |
); | |
?> | |
<?php if (get_comments($parent_comments_args)) : ?> | |
<ul class="comments__list comments__list--children"> | |
<?php | |
$comments = get_comments($parent_comments_args); | |
foreach ($comments as $comment) { ?> | |
<li class="comments__item comment" | |
id="comment-<?php echo $comment->comment_ID; ?>"> | |
<?php echo get_avatar($comment->comment_ID, 80, '', '', array('class' => 'comment__avatar')); ?> | |
<div class="comment__meta"> | |
<h5 class="comment__name"><?php echo $comment->comment_author; ?></h5> | |
<div class="comment__time"><?php comment_time('F j, Y \a\t H:i a'); ?></div> | |
</div> | |
<div class="comment__content"> | |
<div class="comment__bubble"> | |
<?php echo $comment->comment_content; ?> | |
</div> | |
</div> | |
</li> | |
<?php } ?> | |
</ul> | |
<?php endif; ?> | |
</li> | |
<?php } ?> | |
</ul> | |
</div> | |
<?php | |
$comment_form_args = array( | |
'comment_notes_before' => '<p class="form__notes">' . __('Your email address will not be published.') . '</p>', | |
'comment_notes_after' => '', | |
'comment_field' => '<textarea class="form__textarea" name="comment" rows="8" placeholder="" required></textarea>', | |
'fields' => array( | |
'author' => '<input class="form__input" name="author" type="text" placeholder="Name" required>', | |
'email' => '<input class="form__input" name="email" type="email" placeholder="Email" required>', | |
), | |
'must_log_in' => '<p class="form__notes">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.'), wp_login_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', | |
'logged_in_as' => '<p class="form__notes">' . sprintf(__('<a href="%1$s" aria-label="Logged in as %2$s. Edit your profile.">Logged in as %2$s</a>. <a href="%3$s">Log out?</a>'), get_edit_user_link(), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', | |
'id_form' => 'comment-form', | |
'id_submit' => 'submit', | |
'class_form' => 'comment-respond__form form form--post-comment', | |
'class_submit' => 'submit', | |
'name_submit' => 'submit', | |
'title_reply' => __('Leave a Comment'), | |
'title_reply_to' => __('Leave a Comment to %s'), | |
'title_reply_before' => '<h4 class="comment-respond__title">', | |
'title_reply_after' => '</h4>', | |
'cancel_reply_before' => ' <small class="">', | |
'cancel_reply_after' => '</small>', | |
'cancel_reply_link' => __('Cancel reply'), | |
'label_submit' => __('Post Comment'), | |
'submit_button' => '<button class="form__button button" name="%1$s" type="submit">%4$s</button>', | |
'submit_field' => '%1$s %2$s', | |
'format' => 'xhtml', | |
); | |
comment_form($comment_form_args); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment