Inline commenting functionality

This commit is contained in:
2018-12-11 17:35:34 +00:00
parent 0d4dc29741
commit 362c85b2d1
7 changed files with 237 additions and 3 deletions

View File

@@ -2,9 +2,12 @@
$form_settings = array(
class_form => 'comment-respond__form',
class_submit => 'comment-respond__submit',
comment_field => '<label class="comment-respond__label" for="comment">Comment</label><textarea class="comment-respond__input" id="comment" name="comment" cols="25" rows="8" aria-required="true"></textarea></p>',
comment_field => '<div class="comment-respond__item"><label class="comment-respond__label" for="comment">Comment</label><textarea class="comment-respond__input" id="comment" name="comment" cols="25" rows="8" aria-required="true"></textarea></div>',
logged_in_as => '<p class="comment-respond__text">' . sprintf( __( 'Logged in as <a class="link" href="%1$s">%2$s</a>. <a class="link" href="%3$s" title="Log out of this account">Log out?</a>' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ) . '</p>',
title_reply_before => '<h3 id="reply-title" class="comment-respond__title">',
title_reply => '<span class="comment-respond__title-text">Reply</span>',
cancel_reply_before => '<span class="comment-respond__cancel">',
cancel_reply_after => '</span>',
comment_notes_before => '<p class="comment-respond__notes">' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . '</p>',
fields => array(
author => '<div class="comment-respond__item"><label class="comment-respond__label" for="author">' . __( 'Name', 'domainreference' ) . ( $req ? '<span class="comment-respond__required">*</span>' : '' ) . '</label>' . '<input class="comment-respond__input" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></div>',

View File

@@ -1,8 +1,10 @@
<?php
class Windycoys_Walker_Comment extends Walker_Comment {
function start_el(&$output, $comment, $depth = 0, $args = array(), $id = 0) {
function start_el(&$output, $comment, $depth = 0) {
$id = $comment->comment_ID;
$post_id = $comment->comment_post_ID;
$reply_link = get_permalink($post_id) . '?replytocom='.$id.'#respond';
$author_email = $comment->comment_author_email;
$author = $comment->comment_author;
$avatar = get_avatar($comment, 128);
@@ -19,10 +21,11 @@ class Windycoys_Walker_Comment extends Walker_Comment {
$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 .= '<a class="comment__reply" data-comment-author="'.$author.'" data-comment-id="'.$id.'" href="'.$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 class="comment__inline-reply"></div>';
$output .= '</div></div></li>';
}
}