Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

Fix comment avatars in singular featured-image-headers #367

Merged
merged 4 commits into from
Oct 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 3 additions & 39 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,45 +32,9 @@
<?php if ( is_singular() && twentynineteen_can_show_post_thumbnail() ) : ?>
<div class="site-featured-image">
<?php the_post(); ?>
<div class="entry-header">
<?php if ( ! is_page() ) : ?>
<?php $discussion = twentynineteen_can_show_post_thumbnail() ? twentynineteen_get_discussion_data() : null; ?>
<?php endif; ?>

<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>

<?php if ( ! is_page() ) : ?>
<div class="<?php echo ( ! empty( $discussion ) && count( $discussion->authors ) > 0 ) ? 'entry-meta has-discussion' : 'entry-meta'; ?>">
<?php twentynineteen_posted_by(); ?>
<?php twentynineteen_posted_on(); ?>
<span class="comment-count">
<?php
if ( ! empty( $discussion ) ) {
twentynineteen_discussion_avatars_list( $discussion->authors );}
?>
<?php twentynineteen_comment_count(); ?>
</span>
<?php
// Edit post link.
edit_post_link(
sprintf(
wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers. */
__( 'Edit <span class="screen-reader-text">%s</span>', 'twentynineteen' ),
array(
'span' => array(
'class' => array(),
),
)
),
get_the_title()
),
'<span class="edit-link">' . twentynineteen_get_icon_svg( 'edit', 16 ),
'</span>'
);
?>
</div><!-- .entry-meta -->
<?php endif; ?>
<?php $discussion = ! is_page() && twentynineteen_can_show_post_thumbnail() ? twentynineteen_get_discussion_data() : null; ?>
<div class="<?php echo ( ! empty( $discussion ) && count( $discussion->authors ) > 0 ) ? 'entry-header has-discussion' : 'entry-header'; ?>">
<?php get_template_part( 'template-parts/header/entry', 'header' ); ?>
</div><!-- .entry-header -->
<?php rewind_posts(); ?>
</div>
Expand Down
2 changes: 1 addition & 1 deletion inc/template-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function twentynineteen_get_discussion_data() {
}
$authors = array();
$commenters = array();
$user_id = is_user_logged_in() ? get_current_user_id() : -1;
$user_id = -1; // is_user_logged_in() ? get_current_user_id() : -1;
$comments = get_comments(
array(
'post_id' => $current_post_id,
Expand Down
97 changes: 65 additions & 32 deletions sass/site/header/_site-featured-image.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,6 @@
/* Add text shadow to text, to increase readability. */
text-shadow: 0 1px 2px rgba(black, 0.35);

.entry-meta {

font-weight: 500;

> span {

margin-right: $size__spacing-unit;

&:last-child {
margin-right: 0;
}
}

a {

@include link-transition;
color: currentColor;

&:hover {
text-decoration: none;
}
}

.svg-icon {
position: relative;
display: inline-block;
vertical-align: middle;
margin-right: 0.5em;
}
}

/* Set white text color when featured image is set. */
.site-branding .site-title,
.site-branding .site-description,
Expand Down Expand Up @@ -89,7 +58,7 @@
filter: drop-shadow(0 1px 2px rgba(black, 0.35) );
}

/* Site header featured image styles */
/* Entry header */

.site-featured-image .entry-header {

Expand All @@ -109,6 +78,70 @@
background: $color__background-body;
}
}

/* Entry meta */

.entry-meta {

font-weight: 500;

> span {

margin-right: $size__spacing-unit;
display: inline-block;

&:last-child {
margin-right: 0;
}
}

a {

@include link-transition;
color: currentColor;

&:hover {
text-decoration: none;
}
}

.svg-icon {
position: relative;
display: inline-block;
vertical-align: middle;
margin-right: 0.5em;
}

.discussion-avatar-list {
display: none;
}
}

&.has-discussion {

@include media (tablet) {

.entry-meta {
display: flex;
position: relative;
}

.entry-title {
padding-right: calc(1 * (100vw / 12) + #{$size__spacing-unit});
}

.entry-meta .comment-count {
position: absolute;
right: 0;
}

.entry-meta .discussion-avatar-list {
display: block;
position: absolute;
bottom: 100%;
}
}
}
}

/* Custom Logo Link */
Expand Down
30 changes: 21 additions & 9 deletions sass/site/primary/_comments.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
margin-top: calc(3 * #{$size__spacing-unit});
}

.comments-title-wrap,
.comment-list,
.comment-navigation,
> .comment-respond,
Expand All @@ -30,13 +29,31 @@
}

.comments-title-wrap {
align-items: baseline;
display: flex;
justify-content: space-between;

margin: calc(2 * #{$size__spacing-unit}) $size__spacing-unit;

@include media(tablet) {
align-items: baseline;
display: flex;
justify-content: space-between;
margin: calc(3 * #{$size__spacing-unit}) calc(2 * (100vw / 12));
max-width: calc(8 * (100vw / 12));
}

.comments-title {
@include post-section-dash;
margin: 0;

@include media(tablet) {
flex: 1 0 calc(3 * (100vw / 12);
}
}

.discussion-meta {
@include media(tablet) {
flex: 0 0 calc(2 * (100vw / 12);
margin-left: #{$size__spacing-unit};
}
}
}
}
Expand Down Expand Up @@ -329,11 +346,6 @@

.discussion-meta {

.discussion-avatar-list {
display: inline-block;
margin-right: 8px;
}

.discussion-meta-info {
margin: 0;

Expand Down
20 changes: 1 addition & 19 deletions sass/site/primary/_posts-and-pages.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
> span {

margin-right: $size__spacing-unit;
display: inline-block;

&:last-child {
margin-right: 0;
Expand All @@ -91,26 +92,7 @@
}

.entry-meta {

margin: $size__spacing-unit 0;

&.has-discussion .comment-count {

@include media(desktop) {
float: right;
position: relative;
}

.discussion-avatar-list {
display: none;

@include media(desktop) {
bottom: 100%;
display: block;
position: absolute;
}
}
}
}

.entry-footer {
Expand Down
Loading