Advertisement
afsarwebdev

WP if social link then display else not display

May 14th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. //if social media link place then display the social icon else not display
  2. <div class="ic-follow">
  3. <ul>
  4. <li>Follow us:</li>
  5. <?php
  6.  
  7. $social_medias= ['facebook','twitter','linkedin','instagram'];
  8. foreach ($social_medias as $social_media) {
  9. if (array_key_exists($social_media, $instance) && ($instance[$social_media] != null) ) {
  10. ?>
  11. <li>
  12. <a href="<?php echo $instance[$social_media]; ?>"><?php echo $social_media; ?></a>
  13. </li>
  14. <?php
  15. }
  16. }
  17. ?>
  18. </ul>
  19. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement