Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
divの前に変数値をチェックして、変数が空の場合はif条件にあるdivを非表示にし、その逆も同様にします。
例えば:
<?php $var=has_post_thumbnail(); if(!empty($var)){ ?> <div>//some code that is shown only if var has some value</div> <?php } ?>
<?php if(isset($var)) // or check for empty if you want that way{ ?> <div> yes variable is set </div> <?php } else { ?> <div> variable not set division </div> <?php } ?>