Advertisement
rdusnr

Untitled

Oct 14th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1.  
  2. /***************************************************
  3. :: Get social profiles
  4. ***************************************************/
  5.  
  6. if (!function_exists('kleo_get_social_profiles')):
  7.  
  8. function kleo_get_social_profiles($args=false)
  9. {
  10. $output = '';
  11. $icons = '';
  12. $all_options = get_option("kleo_".KLEO_DOMAIN);
  13.  
  14. $defaults = array(
  15. 'container' => 'ul',
  16. 'item_tag' => 'li',
  17. 'target' => '_blank'
  18. );
  19. // Parse incomming $args into an array and merge it with $defaults
  20. $args = wp_parse_args( $args, $defaults );
  21. $args = apply_filters('kleo_get_social_profiles_args', $args);
  22.  
  23. //get social data from theme options
  24. if (!empty($all_options)) {
  25. foreach ($all_options as $k => $opt)
  26. {
  27. if (substr( $k, 0, 7 ) === 'social_' && !empty($opt) ) {
  28. $k = str_replace('social_','',$k);
  29. $title = str_replace(
  30. array('gplus', 'vimeo-squared', 'pinterest-circled', 'instagramm'),
  31. array('Google+', 'Vimeo','Pinterest', 'Instagram'),
  32. $k
  33. );
  34.  
  35. $icons .= '<' . $args['item_tag'] . '>';
  36. $icons .= '<a rel="nofollow" target="'.$args['target'].'" href="'.$opt.'"><i class="icon-'.$k.'"></i><div class="ts-text">'.ucfirst($title).'</div></a>';
  37. $icons .= '</' . $args['item_tag'] . '>';
  38. }
  39. }
  40. }
  41.  
  42. $icons = apply_filters('kleo_get_social_profiles', $icons);
  43. if ($icons != '') {
  44. $output .= '<' . $args['container'] . ' class="kleo-social-icons">';
  45. $output .= $icons;
  46. $output .= '</' . $args['container'] . '>';
  47. }
  48.  
  49. return $output;
  50.  
  51. }
  52. add_shortcode( 'kleo_social_icons', 'kleo_get_social_profiles' );
  53.  
  54. endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement