onetone_get_social

The Onetone onetone get social function.

Description

onetone_get_social( $position, (string) $class = 'top-bar-sns', (string) $placement = 'top', (string) $target = '_blank' ); 

Parameters (4)

0. $position
The position.
1. $class — Optional. (string) => 'top-bar-sns'
The class.
2. $placement — Optional. (string) => 'top'
The placement.
3. $target — Optional. (string) => '_blank'
The target.

Usage

  1. if ( !function_exists( 'onetone_get_social' ) ) { 
  2. require_once '/includes/theme-functions.php'; 
  3.  
  4. // The position. 
  5. $position = null; 
  6.  
  7. // The class. 
  8. $class = 'top-bar-sns'; 
  9.  
  10. // The placement. 
  11. $placement = 'top'; 
  12.  
  13. // The target. 
  14. $target = '_blank'; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = onetone_get_social($position, $class, $placement, $target); 
  18.  

Defined (1)

The function is defined in the following location(s).

/includes/theme-functions.php  
  1. function onetone_get_social( $position, $class = 'top-bar-sns', $placement='top', $target='_blank') { 
  2. global $social_icons; 
  3. $return = ''; 
  4. $rel = ''; 
  5.  
  6. $social_links_nofollow = onetone_option( 'social_links_nofollow', 'no' );  
  7. $social_new_window = onetone_option( 'social_new_window', 'yes' );  
  8. if( $social_new_window == 'no') 
  9. $target = '_self'; 
  10.  
  11. if( $social_links_nofollow == 'yes' ) 
  12. $rel = 'nofollow'; 
  13.  
  14. if(is_array($social_icons) && !empty($social_icons)): 
  15. $return .= '<ul class="'.esc_attr($class).'">'; 
  16. $i = 1; 
  17. foreach($social_icons as $sns_list_item) { 
  18.  
  19. $icon = onetone_option( $position.'_social_icon_'.$i, '' );  
  20. $title = onetone_option( $position.'_social_title_'.$i, '' ); 
  21. $link = onetone_option( $position.'_social_link_'.$i, '' );  
  22. if( $icon !="" ) { 
  23. $return .= '<li><a target="'.esc_attr($target).'" rel="'.$rel.'" href="'.esc_url($link).'" data-placement="'.esc_attr($placement).'" data-toggle="tooltip" title="'.esc_attr( $title).'"><i class="fa fa-'.esc_attr( $icon).'"></i></a></li>'; 
  24. }  
  25. $i++; 
  26. }  
  27. $return .= '</ul>'; 
  28. endif; 
  29. return $return ; 
  30.