I have the following code on my ecommerce product description tabs so that I can enter in all the information one field at a time without having to preformat my product descriptions in Excel with HTML.
<?php echo the_field('color');?><br>
<?php echo the_field('product_info');?><br>
<?php echo the_field('product_size');?><br>
<?php echo the_field('product_size2');?><br>
<?php echo the_field('product_size3');?><br>
Unfortunately this isn't helpful because the
tags outside of the PHP will leave blank lines in cases when no value exists for these fields. How can I incorporate the
tags inside the PHP so that they're used only when a value exists?
I'm clearly new to PHP (and coding in general), so I really appreciate anyone's help. Thank you!
if(isset())orif(!empty())to check if they are set or not empty. nl1.php.net/isset and nl1.php.net/empty<?php echo (empty(the_field('product_info')) ? '' : the_field('product_info').'<br/>'); ?>