Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not show featured image on pages if option is set #707

Merged
merged 1 commit into from
Aug 23, 2024
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
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