From e6736413a416622f117f27a5440b893b506be84c Mon Sep 17 00:00:00 2001 From: Fabiano Alencar Date: Wed, 7 Mar 2018 12:21:26 -0300 Subject: [PATCH] Children comments --- src/assets/js/js.js | 5 +++ src/assets/scss/_comments.scss | 14 ++++++++ src/comments.php | 58 +++++++++++++++--------------- src/functions/single-functions.php | 40 ++++++++++++--------- 4 files changed, 72 insertions(+), 45 deletions(-) diff --git a/src/assets/js/js.js b/src/assets/js/js.js index c2658a9..f5151c3 100644 --- a/src/assets/js/js.js +++ b/src/assets/js/js.js @@ -19,4 +19,9 @@ jQuery(document).ready(function( $ ) { } } }); + + /** + * Align the comments childrens + */ + $('#comments ul.children').addClass('align-children'); }); \ No newline at end of file diff --git a/src/assets/scss/_comments.scss b/src/assets/scss/_comments.scss index 0209250..fbc5348 100644 --- a/src/assets/scss/_comments.scss +++ b/src/assets/scss/_comments.scss @@ -42,6 +42,20 @@ font-size: 0.7rem; } } + .comment-text{ + p{ + margin-bottom: 0; + } + } + } + } + ul{ + &.children{ + &.align-children{ + @media only screen and (min-width: 576px){ + margin-left: 2.3rem; + } + } } } } \ No newline at end of file diff --git a/src/comments.php b/src/comments.php index 2376bf1..846c144 100644 --- a/src/comments.php +++ b/src/comments.php @@ -19,42 +19,43 @@ if (post_password_required()) {
comment_status) : ?> -

", "" ); ?>

-
- - - ID) .'">' . $current_user->display_name . ''; - ?> - -
- -
-
-
- 'img-fluid rounded-circle mr-sm-3', ); - echo get_avatar( $current_user->ID, 60, '', $current_user->display_name, $args ); - ?> - +
+
+ + + ID) .'">' . $current_user->display_name . ''; + ?> +
- + + +
+
+ 'img-fluid rounded-circle mr-sm-3', ); + echo get_avatar( $current_user->ID, 60, '', $current_user->display_name, $args ); + ?> + +
+ +
+ + + ID); ?> +
- - - ID); ?> -
-
+
@@ -62,10 +63,10 @@ if (post_password_required()) { 1 && get_option('page_comments')) : ?> @@ -73,7 +74,6 @@ if (post_password_required()) {

-
\ No newline at end of file diff --git a/src/functions/single-functions.php b/src/functions/single-functions.php index a1f3d52..9a0a346 100644 --- a/src/functions/single-functions.php +++ b/src/functions/single-functions.php @@ -8,8 +8,9 @@ function tainacan_Comments_Callback($comment, $args, $depth) { //get comment to determine type $GLOBALS['comment'] = $comment; - global $post; ?> -
> + global $post; + $class_has = "has-children media comment-". $comment->comment_ID; ?> +
> 'img-fluid rounded-circle mr-sm-3', ); echo get_avatar($comment, 60, '', '', $arg); @@ -34,24 +35,31 @@ function tainacan_Comments_Callback($comment, $args, $depth) {

-

- __('Reply'), - 'depth' => $depth, - 'max_depth' => $args['max_depth'], - 'before' => '

' - ) - )); - edit_comment_link( __( 'Edit' ), '' ); - ?> -

- + __('Reply'), + 'depth' => $depth, + 'max_depth' => $args['max_depth'], + 'before' => '' + ) + )); + edit_comment_link( __( 'Edit' ), '' ); + ?> + +

+ arrow_drop_up +

+
". $content ."
"; +} +add_filter( 'comment_text', 'wrap_Comment', 99); + +/** * Display date of post. */ if ( ! function_exists( 'tainacan_post_date' ) ) {