• Resolved rajikdeymon

    (@rajikdeymon)


    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;
    }
Viewing 1 replies (of 1 total)
  • Plugin Author BasePress

    (@codesavory)

    Thanks for this tip. I am sure this would help others.

    If you loved our plugin, please consider adding a review for this plugin.

Viewing 1 replies (of 1 total)
  • The topic ‘Hide section title without posts’ is closed to new replies.