public
Created

Add GooglePlus Link and Icon on the ARI-Theme of elmastudio.de. Just replace the relevant part of the functions.php and adds the CSS assignment. Do not forget to upload a matching icon in the appropriate folder.

  • Download Gist
functions.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
/* Change the following Part in your functions.php! --- Ari Social Links Widget */
class Ari_SocialLinks_Widget extends WP_Widget {
function Ari_SocialLinks_Widget() {
$widget_ops = array('classname' => 'widget_social_links', 'description' => 'A list with your social profile links' );
$this->WP_Widget('social_links', 'Ari Social Links', $widget_ops);
}
function widget($args, $instance) {
extract($args, EXTR_SKIP);
echo $before_widget;
$title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
$rss_title = empty($instance['rss_title']) ? ' ' : apply_filters('widget_rss_title', $instance['rss_title']);
$rss_url = empty($instance['rss_url']) ? ' ' : apply_filters('widget_rss_url', $instance['rss_url']);
$twitter_title = empty($instance['twitter_title']) ? ' ' : apply_filters('widget_twitter_title', $instance['twitter_title']);
$twitter_url = empty($instance['twitter_url']) ? ' ' : apply_filters('widget_twitter_url', $instance['twitter_url']);
$googleplus_title = empty($instance['googleplus_title']) ? ' ' : apply_filters('widget_googleplus_title', $instance['googleplus_title']);
$googleplus_url = empty($instance['googleplus_url']) ? ' ' : apply_filters('widget_googleplus_url', $instance['googleplus_url']);
$fb_title = empty($instance['fb_title']) ? ' ' : apply_filters('widget_fb_title', $instance['fb_title']);
$fb_url = empty($instance['fb_url']) ? ' ' : apply_filters('widget_fb_url', $instance['fb_url']);
$flickr_title = empty($instance['flickr_title']) ? ' ' : apply_filters('widget_flickr_title', $instance['flickr_title']);
$flickr_url = empty($instance['flickr_url']) ? ' ' : apply_filters('widget_flickr_url', $instance['flickr_url']);
$xing_title = empty($instance['xing_title']) ? ' ' : apply_filters('widget_xing_title', $instance['xing_title']);
$xing_url = empty($instance['xing_url']) ? ' ' : apply_filters('widget_xing_url', $instance['xing_url']);
$linkedin_title = empty($instance['linkedin_title']) ? ' ' : apply_filters('widget_linkedin_title', $instance['linkedin_title']);
$linkedin_url = empty($instance['linkedin_url']) ? ' ' : apply_filters('widget_linkedin_url', $instance['linkedin_url']);
$delicious_title = empty($instance['delicious_title']) ? ' ' : apply_filters('widget_delicious_title', $instance['delicious_title']);
$delicious_url = empty($instance['delicious_url']) ? ' ' : apply_filters('widget_delicious_url', $instance['delicious_url']);
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
echo '<ul>';
if($rss_title == ' ') { echo ''; } else { echo '<li class="widget_sociallinks"><a href=" '. $rss_url .'" class="rss" title=" '.RSS.' ">'. $rss_title .'</a></li>'; }
if($twitter_title == ' ') { echo ''; } else { echo '<li class="widget_sociallinks"><a href=" '. $twitter_url .'" class="twitter" title=" '.Twitter.' ">'. $twitter_title .'</a></li>'; }
if($googleplus_title == ' ') { echo ''; } else { echo '<li class="widget_sociallinks"><a href=" '. $googleplus_url .'" class="googleplus" title=" '.GooglePlus.' ">'. $googleplus_title .'</a></li>'; }
if($fb_title == ' ') { echo ''; } else { echo '<li class="widget_sociallinks"><a href=" '. $fb_url .'" class="facebook" title=" '.Facebook.' ">'. $fb_title .'</a></li>'; }
if($flickr_title == ' ') { echo ''; } else { echo '<li class="widget_sociallinks"><a href=" '. $flickr_url .'" class="flickr" title=" '.Flickr.' ">'. $flickr_title .'</a></li>'; }
if($xing_title == ' ') { echo ''; } else { echo ' <li class="widget_sociallinks"><a href=" '. $xing_url .'" class="xing" title=" '.Xing.' ">'. $xing_title .'</a></li>'; }
if($linkedin_title == ' ') { echo ''; } else { echo '<li class="widget_sociallinks"><a href=" '. $linkedin_url .'" class="linkedin" title=" '.LinkedIn.' ">'. $linkedin_title .'</a></li>'; }
if($delicious_title == ' ') { echo ''; } else { echo '<li class="widget_sociallinks"><a href=" '. $delicious_url .'" class="delicious" title=" '.Delicious.' ">'. $delicious_title .'</a></li>'; }
echo '</ul>';
echo $after_widget;
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['rss_title'] = strip_tags($new_instance['rss_title']);
$instance['rss_url'] = strip_tags($new_instance['rss_url']);
$instance['twitter_title'] = strip_tags($new_instance['twitter_title']);
$instance['twitter_url'] = strip_tags($new_instance['twitter_url']);
$instance['googleplus_title'] = strip_tags($new_instance['googleplus_title']);
$instance['googleplus_url'] = strip_tags($new_instance['googleplus_url']);
$instance['fb_title'] = strip_tags($new_instance['fb_title']);
$instance['fb_url'] = strip_tags($new_instance['fb_url']);
$instance['flickr_title'] = strip_tags($new_instance['flickr_title']);
$instance['flickr_url'] = strip_tags($new_instance['flickr_url']);
$instance['xing_title'] = strip_tags($new_instance['xing_title']);
$instance['xing_url'] = strip_tags($new_instance['xing_url']);
$instance['linkedin_title'] = strip_tags($new_instance['linkedin_title']);
$instance['linkedin_url'] = strip_tags($new_instance['linkedin_url']);
$instance['delicious_title'] = strip_tags($new_instance['delicious_title']);
$instance['delicious_url'] = strip_tags($new_instance['delicious_url']);
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'twitter_title' => '', 'comments_title' => '' ) );
$title = strip_tags($instance['title']);
$rss_title = strip_tags($instance['rss_title']);
$rss_url = strip_tags($instance['rss_url']);
$twitter_title = strip_tags($instance['twitter_title']);
$twitter_url = strip_tags($instance['twitter_url']);
$googleplus_title = strip_tags($instance['googleplus_title']);
$googleplus_url = strip_tags($instance['googleplus_url']);
$fb_title = strip_tags($instance['fb_title']);
$fb_url = strip_tags($instance['fb_url']);
$flickr_title = strip_tags($instance['flickr_title']);
$flickr_url = strip_tags($instance['flickr_url']);
$xing_title = strip_tags($instance['xing_title']);
$xing_url = strip_tags($instance['xing_url']);
$linkedin_title = strip_tags($instance['linkedin_title']);
$linkedin_url = strip_tags($instance['linkedin_url']);
$delicious_title = strip_tags($instance['delicious_title']);
$delicious_url = strip_tags($instance['delicious_url']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('rss_title'); ?>"><?php _e( 'RSS Text:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('rss_title'); ?>" name="<?php echo $this->get_field_name('rss_title'); ?>" type="text" value="<?php echo esc_attr($rss_title); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('rss_url'); ?>"><?php _e( 'RSS URL:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('rss_url'); ?>" name="<?php echo $this->get_field_name('rss_url'); ?>" type="text" value="<?php echo esc_attr($rss_url); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('twitter_title'); ?>"><?php _e( 'Twitter Text:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('twitter_title'); ?>" name="<?php echo $this->get_field_name('twitter_title'); ?>" type="text" value="<?php echo esc_attr($twitter_title); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('twitter_url'); ?>"><?php _e( 'Twitter URL:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('twitter_url'); ?>" name="<?php echo $this->get_field_name('twitter_url'); ?>" type="text" value="<?php echo esc_attr($twitter_url); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('googleplus_title'); ?>"><?php _e( 'googleplus Text:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('googleplus_title'); ?>" name="<?php echo $this->get_field_name('googleplus_title'); ?>" type="text" value="<?php echo esc_attr($googleplus_title); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('googleplus_url'); ?>"><?php _e( 'googleplus URL:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('googleplus_url'); ?>" name="<?php echo $this->get_field_name('googleplus_url'); ?>" type="text" value="<?php echo esc_attr($googleplus_url); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('fb_title'); ?>"><?php _e( 'Facebook Text:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('fb_title'); ?>" name="<?php echo $this->get_field_name('fb_title'); ?>" type="text" value="<?php echo esc_attr($fb_title); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('fb_url'); ?>"><?php _e( 'Facebook URL:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('fb_url'); ?>" name="<?php echo $this->get_field_name('fb_url'); ?>" type="text" value="<?php echo esc_attr($fb_url); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('flickr_title'); ?>"><?php _e( 'Flickr Text:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('flickr_title'); ?>" name="<?php echo $this->get_field_name('flickr_title'); ?>" type="text" value="<?php echo esc_attr($flickr_title); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('flickr_url'); ?>"><?php _e( 'Flickr URL:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('flickr_url'); ?>" name="<?php echo $this->get_field_name('flickr_url'); ?>" type="text" value="<?php echo esc_attr($flickr_url); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('xing_title'); ?>"><?php _e( 'Xing Text:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('xing_title'); ?>" name="<?php echo $this->get_field_name('xing_title'); ?>" type="text" value="<?php echo esc_attr($xing_title); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('xing_url'); ?>"><?php _e( 'Xing URL:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('xing_url'); ?>" name="<?php echo $this->get_field_name('xing_url'); ?>" type="text" value="<?php echo esc_attr($xing_url); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('linkedin_title'); ?>"><?php _e( 'LinkedIn Text:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('linkedin_title'); ?>" name="<?php echo $this->get_field_name('linkedin_title'); ?>" type="text" value="<?php echo esc_attr($linkedin_title); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('linkedin_url'); ?>"><?php _e( 'LinkedIn URL:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('linkedin_url'); ?>" name="<?php echo $this->get_field_name('linkedin_url'); ?>" type="text" value="<?php echo esc_attr($linkedin_url); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('delicious_title'); ?>"><?php _e( 'Delicious Text:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('delicious_title'); ?>" name="<?php echo $this->get_field_name('delicious_title'); ?>" type="text" value="<?php echo esc_attr($delicious_title); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('delicious_url'); ?>"><?php _e( 'Delicious URL:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('delicious_url'); ?>" name="<?php echo $this->get_field_name('delicious_url'); ?>" type="text" value="<?php echo esc_attr($delicious_url); ?>" /></label></p>
 
<?php
}
}
 
// register Ari SocialLinks Widget
add_action('widgets_init', create_function('', 'return register_widget("Ari_SocialLinks_Widget");'));
style.css
CSS
1 2 3 4
/* --- Add this to the Social Links Custom Widget Part of your style.css --- */
ul.sidebar li.widget_sociallinks a.googleplus {
background:url(images/googleplus-icon.png) 0 0 no-repeat;
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.