Skip to content

Commit

Permalink
Do not show featured image on pages if option is set (#707)
Browse files Browse the repository at this point in the history
  • Loading branch information
albig authored Aug 23, 2024
1 parent 6f89447 commit c035528
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions phpcs-report.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="3.9.2">
</checkstyle>

5 changes: 0 additions & 5 deletions sass/_single.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@
margin: 0;
}


header.has-no-post-thumbnail {
margin-bottom: 0;
}

body.page .entry-header {
padding-bottom: 35px;
}
11 changes: 8 additions & 3 deletions template-parts/content-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
* @package sunflower
*/

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

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

<?php sunflower_post_thumbnail( $sunflower_styled_layout, true ); ?>
<?php
if ( $sunflower_show_post_thumbnail ) {
sunflower_post_thumbnail( $sunflower_styled_layout, true );
}
?>

<div class="entry-content accordion">
<?php
Expand Down

0 comments on commit c035528

Please sign in to comment.