custom post types – hide specific div on single.php


I’ve been working on WP since a week so far i’ve seen bunch of tutorials and videos about wp but i feel stuck and since i’m a wp noob i cant find or think any solution for a simple problem.
i have created custom field using plug-in for a custom post type, my problem is i want to hide the -div- when there is nothing written in the field.

So far i tried bunch of entries from this site and SO but i havent complished anything. all i need is a basic structure for hiding the -div- in case if there is no entry for the related post field..

below my single.php’s -div- part that i want to hide… since im new and watched so much stuff i feel extremely confused and cant develop any solution..

<div class="card-header" role="tab" id="headingOne1">
                  <a data-toggle="collapse" data-parent="#accordionEx" href="#collapseOne1" aria-expanded="true"
                    <h5 class="mb-0">
                      <?php the_field('button1-mi-s1-b'); ?> <i class="fas fa-angle-down rotate-icon"></i>

                <!-- Card body -->
                <div id="collapseOne1" class="collapse" role="tabpanel" aria-labelledby="headingOne1"
                  <div class="card-body">
                    <?php the_field('button1-mi-s1-yazi'); ?>


thanks for your time..
best regards

wp_noob 1 year 2022-01-09T09:35:28-05:00 0 Answers 0 views 0

Leave an answer