Hide section title without posts
-
Hi,
I wonder why the section title is shown when there is no post but only sub sections.
Depending on the used theme, this can be ugly. So here is a tip to remove the section title element if it hasn’t any posts:
– Open “wp-content\plugins\basepress\themes\[THEME]\template-parts\single-section-content.php” from your used theme.
– Search for the first <div> after the line “foreach ( $bpkb_sections as $bpkb_section )” and append some php code to the div class name.
The class name is depending on your theme.
f.ex. for the modern theme:CHANGE:
<div class="bpress-single-section">
TO:
<div class="bpress-single-section<?php if(empty($bpkb_section->posts)) {echo " bpress-headline-only"; } ?>">
– then you can add the following custom css to the custom css section in the theme settings:
.bpress-headline-only { display: none; }
- The topic ‘Hide section title without posts’ is closed to new replies.