Skip to content

Commit 306918f

Browse files
committed
Do not show featured image on pages if option is set
1 parent 6f89447 commit 306918f

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

phpcs-report.xml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<checkstyle version="3.9.2">
3+
</checkstyle>
4+

sass/_single.scss

-5
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@
4242
margin: 0;
4343
}
4444

45-
46-
header.has-no-post-thumbnail {
47-
margin-bottom: 0;
48-
}
49-
5045
body.page .entry-header {
5146
padding-bottom: 35px;
5247
}

template-parts/content-page.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
* @package sunflower
88
*/
99

10-
$sunflower_styled_layout = (bool) get_post_meta( $post->ID, '_sunflower_styled_layout', true ) ?? false;
11-
$sunflower_class = $args['class'] ?? '';
10+
$sunflower_show_post_thumbnail = has_post_thumbnail() && ! get_post_meta( $post->ID, '_sunflower_hide_feature_image', true );
11+
$sunflower_styled_layout = (bool) get_post_meta( $post->ID, '_sunflower_styled_layout', true ) ?? false;
12+
$sunflower_class = $args['class'] ?? '';
1213
?>
1314

1415
<article id="post-<?php the_ID(); ?>" <?php post_class( $sunflower_class ); ?>>
@@ -20,7 +21,11 @@
2021
}
2122
?>
2223

23-
<?php sunflower_post_thumbnail( $sunflower_styled_layout, true ); ?>
24+
<?php
25+
if ( $sunflower_show_post_thumbnail ) {
26+
sunflower_post_thumbnail( $sunflower_styled_layout, true );
27+
}
28+
?>
2429

2530
<div class="entry-content accordion">
2631
<?php

0 commit comments

Comments
 (0)