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" aria-controls="collapseOne1"> <h5 class="mb-0"> <?php the_field('button1-mi-s1-b'); ?> <i class="fas fa-angle-down rotate-icon"></i> </h5> </a> </div> <!-- Card body --> <div id="collapseOne1" class="collapse" role="tabpanel" aria-labelledby="headingOne1" data-parent="#accordionEx"> <div class="card-body"> <?php the_field('button1-mi-s1-yazi'); ?> </div> </div> </div>
thanks for your time..
Leave an answer