Add comments template

This commit is contained in:
2018-12-10 22:31:59 +00:00
parent 907f4f4f3e
commit bc0e10dee5
10 changed files with 172 additions and 6 deletions

View File

@@ -1,6 +1,33 @@
<?php
class Windycoys_Walker extends Walker_Nav_Menu {
class Windycoys_Walker_Comment extends Walker_Comment {
function start_el(&$output, $comment, $depth = 0, $args = array(), $id = 0) {
$id = $comment->comment_ID;
$author_email = $comment->comment_author_email;
$author = $comment->comment_author;
$avatar = get_avatar($comment, 128);
$date = get_comment_date('jS F, Y', $id).' at '.get_comment_date('H:i', $id);
$content = $comment->comment_content;
$comment_depth = $depth > 0 ? ' comments__item--depth-'.$depth : '';
$output .= '<li class="comments__item'.$comment_depth.'">';
$output .= '<div class="comment">';
$output .= '<div class="comment__head">';
$output .= '<div class="comment__avatar">'.$avatar.'</div>';
$output .= '<div class="comment__metadata">';
$output .= '<span class="comment__author">'.$author.'</span>';
$output .= '<span class="comment__date">'.$date.'</span>';
$output .= '</div></div>';
$output .= '<div class="comment__body">'.$content.'</div>';
$output .= '<div class="comment__foot">';
$output .= '<a class="comment__reply" href="'.get_comment_reply_link().'">';
$output .= '<span class="comment__reply-icon">';
$output .= '<svg class="icon icon--extra-small"><use href="#icon-reply"></use></svg></span>';
$output .= '<span class="comment__reply-text">Reply</span></a>';
$output .= '</div></div></li>';
}
}
class Windycoys_Walker_Nav extends Walker_Nav_Menu {
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
$title = $item->post_title;
$uri = get_site_url() . '/' . $item->post_name;
@@ -15,7 +42,7 @@ function windycoys_nav() {
wp_nav_menu(array(
'container' => 'ul',
'menu_class' => 'nav__list nav__list--sub-list',
'walker' => new Windycoys_Walker()
'walker' => new Windycoys_Walker_Nav()
));
}