I have social icons that are being set via my theme options in WP. Of course if they are not entered I am getting an Undefined Index error. I tried wrapping isset around which removes the error, but when my options panel is saved it shows all the icons? Even if they have not been set? Confused on how to do the isset correctly?
<ul class="social-icons">
<?php if ( $theme_global['social-twitter'] ) { ?>
<li><a class="social-twitter" href="<?php echo $theme_global['social-twitter']; ?>" title="<?php _e( 'View Twitter Profile', 'lang' ); ?>" target="_blank"><i class="fa fa-twitter"></i><div class="tooltip"><span>Twitter</span></div></a></li>
<?php } if ( $theme_global['social-facebook'] ) { ?>
<li><a class="social-facebook" href="<?php echo $theme_global['social-facebook']; ?>" title="<?php _e( 'View Facebook Profile', 'lang' ); ?>" target="_blank"><i class="fa fa-facebook"></i><div class="tooltip"><span>Facebook</span></div></a></li>
<?php } if ( $theme_global['social-linkedin'] ) { ?>
<li><a class="social-linkedin" href="<?php echo $theme_global['social-linkedin']; ?>" title="<?php _e( 'View Linkedin Profile', 'lang' ); ?>" target="_blank"><i class="fa fa-linkedin"></i><div class="tooltip"><span>Linkedin</span></div></a></li>
<?php } if ( $theme_global['social-pinterest'] ) { ?>
<li><a class="social-pinterest" href="<?php echo $theme_global['social-pinterest']; ?>" title="<?php _e( 'View Pinterest Profile', 'lang' ); ?>" target="_blank"><i class="fa fa-pinterest"></i><div class="tooltip"><span>Pinterest</span></div></a></li>
<?php } ?>
</ul>
Many thanks