Advertisement
afsarwebdev

wp-if-link-set-then-icon-show-else-not-show

Jul 26th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. // if i linked keep then social icon show else not show within ul
  2. <?php
  3. if (isset($royalcusine['linkedin']) && $royalcusine['linkedin'] !=null) {
  4. ?>
  5. <li>
  6. <a href="<?php echo $royalcusine['linkedin']; ?>"><i class="icofont icofont-brand-linkedin"></i></a>
  7. </li>
  8. <?php
  9. }
  10. ?>
  11. //Within a loop to show multiple soical icons
  12. <?php
  13. foreach ($royalcusine as $key => $value) {
  14. if (in_array($key, ['facebook','twitter','linkedin','google-plus','pinterest']) && $value !=null) {
  15. ?>
  16. <li>
  17. <a href="<?php echo $value; ?>"><i class="icofont icofont-social-<?php echo $key; ?>"></i></a>
  18. </li>
  19. <?php
  20. }
  21. }
  22.  
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement