Advertisement
bdbrown

Add New Social Icons in Follow Heading

Dec 16th, 2014
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.94 KB | None | 0 0
  1. The social buttons in the Follow panel are generated in function "alx_social_links" in functions.php. I copied the function to my child theme and edited it there. The full function is shown below. At the end of the function, just prior to the closing ul tag, I added two echo statements to generate the icons. I used the same classes that are assigned to the theme social icons, plus I added a class to the feedly image so I could style it using css.
  2.  
  3. /*  Social links
  4. /* ------------------------------------ */
  5. if ( ! function_exists( 'alx_social_links' ) ) {
  6.  
  7.     function alx_social_links() {
  8.         if ( !ot_get_option('social-links') =='' ) {
  9.             $links = ot_get_option('social-links', array());
  10.             if ( !empty( $links ) ) {
  11.                 echo '<ul class="social-links">';  
  12.                 foreach( $links as $item ) {
  13.                    
  14.                     // Build each separate html-section only if set
  15.                     if ( isset($item['title']) && !empty($item['title']) )
  16.                         { $title = 'title="' .$item['title']. '"'; } else $title = '';
  17.                     if ( isset($item['social-link']) && !empty($item['social-link']) )
  18.                         { $link = 'href="' .$item['social-link']. '"'; } else $link = '';
  19.                     if ( isset($item['social-target']) && !empty($item['social-target']) )
  20.                         { $target = 'target="' .$item['social-target']. '"'; } else $target = '';
  21.                     if ( isset($item['social-icon']) && !empty($item['social-icon']) )
  22.                         { $icon = 'class="fa ' .$item['social-icon']. '"'; } else $icon = '';
  23.                     if ( isset($item['social-color']) && !empty($item['social-color']) )
  24.                         { $color = 'style="color: ' .$item['social-color']. ';"'; } else $color = '';
  25.                    
  26.                     // Put them together
  27.                     if ( isset($item['title']) && !empty($item['title']) && isset($item['social-icon']) && !empty($item['social-icon']) && ($item['social-icon'] !='fa-') ) {
  28.                     echo '<li><a rel="nofollow" class="social-tooltip" '.$title.' '.$link.' '.$target.'><i '.$icon.' '.$color.'></i></a></li>';
  29.                     }
  30.                 }
  31.        
  32.  
  33.         // Add the feedly social link
  34.             echo '<li><a rel="nofollow" class="social-tooltip" title="Feedly" href="http://cloud.feedly.com/#subscription%2Ffeed%2Fhttp%3A%2F%2Fwww.msn.com" target="_blank">
  35.         <img class="feedly-img" src="http://s3.feedly.com/img/follows/feedly-follow-logo-green_2x.png"/></a></li>';
  36.        
  37.         // Add the flipboard social link
  38.             echo '<li><a rel="nofollow" class="social-tooltip" data-flip-widget="flipit" href="https://flipboard.com" target="_blank">
  39.         <script src="https://cdn.flipboard.com/web/buttons/js/flbuttons.min.js" type="text/javascript"></script></a></li>';
  40.  
  41.        
  42.                 echo '</ul>';
  43.             }
  44.         }
  45.     }
  46.    
  47. }
  48.  
  49.  
  50.  
  51. I added this css to size and move the feedly icon. Something about the icons made the title bar expand down down a bit. I didn't have time to work on that so just took a couple of px off the vertical padding so it would line up:
  52.  
  53. .feedly-img {
  54. height: 32px;
  55. width: 32px;
  56. margin-bottom: -8px;
  57. }
  58.  
  59. .s1 .sidebar-top {
  60. padding-top: 14px;
  61. padding-bottom: 14px;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement