I have a WordPress footer file that display 3 social network icons as <li>
based on inputs in the themes options panel.
All works fine if there is 1 or more link/image but if there are none, in the rendered source code I am left with open/closing <div>
and <li>
with no data in them. As far as visitors are concerned they would be none the wiser, but is there a way to hide these tags if there is no data.
This is the code I am using;
<div class="eight columns">
<div class="social">
<ul>
<?php
foreach (array("twitter","facebook","linkedin") as $option)
($tmp=of_get_option('fab_social_'.$option.'_url')) && (print('<li><a href="'.$tmp.'"><img src="'.of_get_option('fab_social_'.$option.'_icon').'" alt="Follow us on '.ucfirst($option).'"></a></li>'));
?>
</ul>
</div>
</div>