ACF fields only show up now if they exist.
authorLaury GvR <laury@gaslightmedia.com>
Wed, 16 Nov 2016 18:47:07 +0000 (13:47 -0500)
committerLaury GvR <laury@gaslightmedia.com>
Wed, 16 Nov 2016 18:47:07 +0000 (13:47 -0500)
Advanced custom form fields were displaying a div even if they had
no content.

sections/interior-page.php

index 0d6ca70..73b7af2 100644 (file)
                             </div>
                             
                             <?php if (is_page_template('bottom-sections.php')) { ?>
-                                <div id="glm-acf-first" class="glm-acf-field row">
-                                    <div class="glm-acf-text small-12 columns">
-                                        <?php the_field('glm-acf-first-text'); ?>
+                                <?php if (get_field('glm-acf-first-text')) { ?>
+                                    <div id="glm-acf-first" class="glm-acf-field row">
+                                        <div class="glm-acf-text small-12 columns">
+                                            <?php the_field('glm-acf-first-text'); ?>
+                                        </div>
                                     </div>
-                                </div>
-                                <div id="glm-acf-second" class="glm-acf-field row">
-                                    <div class="glm-acf-text small-12 columns">
-                                        <?php the_field('glm-acf-second-text'); ?>
+                                <?php } ?>
+                                <?php if (get_field('glm-acf-second-text')) { ?>
+                                    <div id="glm-acf-second" class="glm-acf-field row">
+                                        <div class="glm-acf-text small-12 columns">
+                                            <?php the_field('glm-acf-second-text'); ?>
+                                        </div>
                                     </div>
-                                </div>
+                                <?php } ?>
                             <?php } ?>
                         </div>
                     </main>
\ No newline at end of file