This is really more of a PHP question than a WordPress question. But, based on this example code:
<li><a href="http://<?php echo the_field('helpline_url'); ?>" class="tiptip web" title="<?php echo the_field('helpline_url'); ?>" target="_blank"><?php echo the_field('helpline_url'); ?></a></li>
…it appears that the the_field()
function returns a value (since you then echo that returned value. Thus, simply wrap the entire <li>
output in a conditional, using the_field()
:
<?php
if ( the_field( 'helpline_url' ) ) {
?>
<li><a href="http://<?php echo the_field('helpline_url'); ?>" class="tiptip web" title="<?php echo the_field('helpline_url'); ?>" target="_blank"><?php echo the_field('helpline_url'); ?></a></li>
<?php
}
?>