Myzwer / foothillschurch

Bootcamp II is a wordpress theme (as well as an inside joke) designed to suit the needs of foothillschurch.com. It makes use of webpack, Babel, Sass, Tailwind, Browsersync, PostCSS, ESLint, Stylelint, Prettier and more. It is meant for that site, but if you can use it by all means go for it.
1 stars 1 forks source link

Information Section Block: Missing content #70

Closed rain2o closed 2 weeks ago

rain2o commented 1 month ago

The content field of each repeatable section isn't required in the Information Section block. So, you have a check if have_rows( 'information_section' ), but then in each iteration you output the_sub_field( 'section_content' ) even if there's no content. The result is just lines.

Screenshot 2024-07-27 at 12 33 42

I'd suggest making the field required. But, if you don't do that, you could add the condition of the field.

if (have_rows('information_section')) :
    while (have_rows('information_section')) : the_row();
        $content = get_sub_field('section_content');
        if ($content) : ?>
            <div class="col-span-12 md:col-span-6 py-5">
                <hr class="border-t border-2 border-black">
                <div class="pt-3 prose">
                    <?php echo $content; ?>
                </div>
            </div>
<?php endif;
    endwhile;
endif; ?>