Guest User

Untitled

a guest
May 16th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. add_filter( 'wp_nav_menu_items', 'woo_custom_add_sociallink_navitems', 10, 2 );
  2.  
  3. function woo_custom_add_sociallink_navitems ( $items, $args ) {
  4. global $woo_options;
  5.  
  6. if ( $args->theme_location == 'primary-menu' ) {
  7.  
  8. $template_directory = get_template_directory_uri();
  9.  
  10. $profiles = array(
  11. 'twitter' => __( 'Follow us on Twitter' , 'woothemes' ),
  12. 'facebook' => __( 'Connect on Facebook' , 'woothemes' ),
  13. 'youtube' => __( 'Watch on YouTube' , 'woothemes' ),
  14. 'flickr' => __( 'See photos on Flickr' , 'woothemes' ),
  15. 'linkedin' => __( 'Connect on LinkedIn' , 'woothemes' ),
  16. 'delicious' => __( 'Discover on Delicious' , 'woothemes' ),
  17. 'googleplus' => __( 'View Google+ profile' , 'woothemes' )
  18. );
  19.  
  20. foreach ( $profiles as $key => $text ) {
  21. if ( isset( $woo_options['woo_connect_' . $key] ) && $woo_options['woo_connect_' . $key] != '' ) {
  22. $class = 'menu-item menu-item-type-social menu-item-object-social menu-item-' . $key;
  23. $items .= '<li id="menu-item-' . $key . '" class="' . $class . '">';
  24. $items .= '<a href="' . $woo_options['woo_connect_' . $key] . '" title="' . esc_attr( $text ) . '">';
  25. $items .= '<img src="' . $template_directory . '/images/ico-social-' . $key . '.png" title="' . esc_attr( $text ) . '" alt=""/>';
  26. $items .= '</a></li>' . "\n";
  27. }
  28. }
  29.  
  30.  
  31. // Add a custom RSS icon, linking to Feedburner or default RSS feed.
  32. $rss_url = get_bloginfo_rss( 'rss2_url' );
  33. $text = __( 'Subscribe to our RSS feed', 'woothemes' );
  34. if ( isset( $woo_options['woo_feed_url'] ) && ( $woo_options['woo_feed_url'] != '' ) ) { $rss_url = $woo_options['woo_feed_url']; }
  35.  
  36. $items .= '<span id="social-icon-rss" class="social-icon social-icon-rss"><a href="' . $rss_url . '" title="' . esc_attr( $text ) . '">' . '<img src="' . $template_directory . '/images/ico-social-rss.png" alt="' . esc_attr( $text ) . '">' . '</a></span>' . "\n";
  37.  
  38. $items .= '</div><!--/#social-links-->' . "\n";
  39.  
  40.  
  41.  
  42. }
  43.  
  44. return $items;
  45. } // End woo_custom_add_sociallink_navitems()
Add Comment
Please, Sign In to add comment