Skip to content

Commit

Permalink
fix: improve appearance of caption with beside featured image setting (
Browse files Browse the repository at this point in the history
  • Loading branch information
laurelfulford authored Apr 27, 2020
1 parent df53d07 commit 1da6e44
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 6 deletions.
37 changes: 36 additions & 1 deletion newspack-theme/sass/site/primary/_posts-and-pages.scss
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ body.page {
}

.featured-image-behind + figcaption,
.featured-image-beside + figcaption {
.featured-image-beside figcaption {
margin: #{0.25 * $size__spacing-unit} auto 0;
width: 1200px;
max-width: 100%;
Expand Down Expand Up @@ -648,6 +648,41 @@ body.page {
.entry-title {
font-size: $font__size-xxl;
}

figcaption {
bottom: 0;
color: #fff;
left: 50%;
position: absolute;
width: 50%;

a,
a:visited {
color: #fff;
text-decoration: underline;
}

a:hover {
text-decoration: none;
}

> span {
display: inline-block;
max-width: 780px;
padding: #{2 * $size__spacing-unit} $size__spacing-unit $size__spacing-unit;
position: relative;
}

&::before {
background-image: linear-gradient( rgba( 0, 0, 0, 0 ), rgba( 0, 0, 0, 0.5 ) 50% );
bottom: 0;
content: '';
height: 100%;
left: 0;
position: absolute;
width: 100%;
}
}
}
}

Expand Down
9 changes: 4 additions & 5 deletions newspack-theme/template-parts/post/large-featured-image.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@
</div><!-- .wrapper -->

<?php newspack_post_thumbnail(); ?>
</div><!-- .featured-image-behind -->

<?php if ( $caption ) : ?>
<figcaption><?php echo wp_kses_post( $caption ); ?></figcaption>
<?php endif; ?>

<?php if ( $caption ) : ?>
<figcaption><span><?php echo wp_kses_post( $caption ); ?></span></figcaption>
<?php endif; ?>
</div><!-- .featured-image-behind -->
<?php else : ?>

<header class="entry-header">
Expand Down

0 comments on commit 1da6e44

Please sign in to comment.