Skip to content
Permalink
Browse files

Show each reaction section only if there is something to show

Checking for an empty array of reply comments specifically avoids
displaying every single comment on the site πŸ™ƒ
  • Loading branch information
jeremyfelt committed Jan 13, 2020
1 parent 27b1268 commit 60059092a19a732f2002afae24cac00e0ffa6108
Showing with 15 additions and 0 deletions.
  1. +13 βˆ’0 comments.php
  2. +2 βˆ’0 css/style.css
@@ -76,6 +76,8 @@

}

if ( 0 < count( $typed_comments['like'] ) ) :

?>

<!-- Is there a semantic way to group a collection of reactions? -->
@@ -116,6 +118,9 @@
<?php
}

endif;

if ( 0 < count( $typed_comments['bookmark'] ) ) :
?>

<h3>Bookmarks</h3>
@@ -155,6 +160,9 @@
<?php
}

endif;

if ( 0 < count( $typed_comments['mention'] ) ) :
?>

<h3>Mentions</h3>
@@ -190,6 +198,9 @@
<?php
}

endif;

if ( 0 < count( $typed_comments['reply'] ) ) :
?>

<h3>Replies</h3>
@@ -207,6 +218,8 @@
'format' => 'html5',
), $comments );

endif;

// If comments are closed and there are comments, let's leave a little note, shall we?
if ( ! comments_open() ) {
?>
@@ -1337,6 +1337,7 @@ pre.wp-block-code code {
}

.comment-author,
.p-bookmark,
.p-mention,
.p-like {
display: flex;
@@ -1345,6 +1346,7 @@ pre.wp-block-code code {
}

.comment-author img,
.p-bookmark img,
.p-mention img,
.p-like img {
margin-right: .5em;

0 comments on commit 6005909

Please sign in to comment.
You can’t perform that action at this time.