Skip to content

Commit 2c0a0ed

Browse files
committed
Fixed Related Project & Posts Image size
1 parent b721aee commit 2c0a0ed

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

inc/class-shapely-related-posts.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,9 @@ function output_related_posts() {
226226

227227
echo '<div class="item">';
228228
if ( has_post_thumbnail( $related_posts->post->ID ) ) {
229-
echo '<a href="' . esc_url( get_the_permalink() ) . '">' . get_the_post_thumbnail( $related_posts->post->ID, 'shapely-grid' ) . '</a>';
229+
echo '<a href="' . esc_url( get_the_permalink() ) . '" class="related-item-thumbnail" style="background-image: url( ' . get_the_post_thumbnail_url( $related_posts->post->ID, 'shapely-grid' ) . ' )">' . get_the_post_thumbnail( $related_posts->post->ID, 'shapely-grid' ) . '</a>';
230230
} else {
231-
echo '<a href="' . esc_url( get_the_permalink() ) . '"><img class="wp-post-image" alt="" src="' . get_template_directory_uri() . '/assets/images/placeholder.jpg" /></a>';
231+
echo '<a href="' . esc_url( get_the_permalink() ) . '" class="related-item-thumbnail" style="background-image: url( ' . get_template_directory_uri() . '/assets/images/placeholder.jpg )"><img class="wp-post-image" alt="" src="' . get_template_directory_uri() . '/assets/images/placeholder.jpg" /></a>';
232232
}
233233

234234
if ( $show_title ) {

style.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4155,6 +4155,17 @@ footer.bg-dark a {
41554155
margin-right: 20px;
41564156
color: #001c28; }
41574157

4158+
.shapely-related-posts .owl-carousel .owl-item .related-item-thumbnail img {
4159+
display: none;
4160+
}
4161+
.shapely-related-posts .related-item-thumbnail {
4162+
display: block;
4163+
padding-bottom: 85%;
4164+
background-repeat: no-repeat;
4165+
background-size: cover;
4166+
background-position: center;
4167+
}
4168+
41584169
.pt0 {
41594170
padding-top: 30px; }
41604171

0 commit comments

Comments
 (0)