HELP: Center Social Links

2 replies
Website: www.arcanemarketing.com

Problem: The social links in the widget box on the side are hitting the left side. How do I center them?

Widget code to help you: the-social-links/includes/options.php (inactive)

<?php
class TheSocialLinkWidget extends WP_Widget{

function TheSocialLinkWidget() {
$widget_ops = array(
'classname' => 'the-social-link',
'description' => 'Display your social links in your sidebar.'
);

parent::WP_Widget('the-social-link-widget', 'The Social Links', $widget_ops);
}

function form($instance) {
$title = esc_attr($instance['title']);
?>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
</p>
<?php
}

function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
return $instance;
}

function widget($args, $instance) {
global $social_networks;
global $plugin_path;
$icon_size = get_option( 'tsl_icon_size' );
extract( $args );
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
?>
<?php echo $before_widget; ?>
<?php if ( !empty ( $title ) )
echo $before_title . $title . $after_title; ?>

<?php foreach($social_networks as $slug => $name):?>
<?php $tsl_link = get_option('tsl_'.$slug);?>
<?php if ( !empty( $tsl_link ) ):?>
<a href="<?php echo $tsl_link;?>" rel="nofollow" target="<?php echo get_option('tsl_link_target');?>"><img src="<?php echo $plugin_path;?>icons/<?php echo $icon_size.'/'.$slug;?>.png" title="<?php echo $name;?>" alt="<?php echo $name;?>" /></a>
<?php endif;?>
<?php endforeach;?>
<?php if(get_option('tsl_display_credit')):?>
<br /><a style="font-size: 0.8em;" href="http://digitalleap.co.za/wordpress/plugin/the-social-links/">Provided by The Social Links</a>
<?php endif;?>
<?php echo $after_widget; ?>
<?php
}

}
add_action('widgets_init', create_function('', 'return register_widget("TheSocialLinkWidget");'));
?>


OR: the-social-links/the-social-links.php (active)

<?php
/*
Plugin Name: The Social Links
Plugin URI: http://digitalleap.co.za/wordpress/p...-social-links/
Description: The Social Links plugin adds a widget to your WordPress website allowing you to display icons linking your social profiles.
Version: 0.4.2.2
Author: Digital Leap
Author URI: http://digitalleap.co.za/
License: GPL2

Copyright 2011 Seagyn Davis (email : seagyn@gmail.com) and Digital Leap (email : info@digitalleap.co.za)

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

$social_networks = array(
'aim' => 'AIM',
'android' => 'Android',
'appstore' => 'Apple Store',
'bebo' => 'Bebo',
'blogger' => 'Blogger',
'delicious' => 'Delicious',
'designfloat' => 'DesignFloat',
'deviantart' => 'DeviantArt',
'digg' => 'Digg',
'dribbble' => 'Dribbble',
'ebay' => 'eBay',
'evernote' => 'Evernote',
'facebook' => 'Facebook',
'feedburner-2' => 'Feedburner',
'flickr-1' => 'Flickr',
'foursquare' => 'foursquare',
'gmail' => 'Gmail',
'google-plus' => 'Google+',
'gowalla' => 'Gowalla',
'grooveshark-1' => 'Grooveshark',
'hi5-1' => 'Hi5',
'lastfm' => 'LastFM',
'linkedin' => 'LinkedIn',
'livejournal' => 'LiveJournal',
'metacafe' => 'Metacafe',
'mobileme' => 'MobileMe',
'msn-1' => 'MSN',
'myspace' => 'MySpace',
'ning' => 'Ning',
'openid-2' => 'OpenID',
'orkut' => 'orkut',
'pandora' => 'Pandora',
'paypal' => 'PayPal',
'picasa' => 'Picasa',
'plurk' => 'Plurk',
'posterous' => 'Posterous',
'reddit' => 'Reddit',
'rss' => 'RSS Feed',
'skype' => 'Skype',
'stumbleupon' => 'StumbleUpon',
'tumblr' => 'Tumblr',
'twitter' => 'Twitter',
'vimeo' => 'Vimeo',
'wordpress' => 'WordPress',
'xing' => 'XING',
'yelp' => 'Yelp',
'youtube' => 'YouTube',
'youversion' => 'YouVersion'
);

$plugin_path = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__) );

include 'includes/options.php';
include 'includes/widget.php';

register_activation_hook( __FILE__, 'tsl_defaults' );

function tsl_defaults(){
if( !get_option( 'tsl_icon_size' ) )
update_option( 'tsl_icon_size', '32x32' );
if( !get_option( 'tsl_display_credit' ) )
update_option( 'tsl_display_credit', false );
if( !get_option( 'tsl_link_target' ) )
update_option( 'tsl_link_target', '_parent' );
}

function tsl_plugin_action_links( $links, $file ) {
if ( $file == plugin_basename( dirname(__FILE__).'/the-social-links.php' ) ) {
$links[] = '<a href="themes.php?page=the-social-link">'.__('Settings').'</a>';
}

return $links;
}

add_filter( 'plugin_action_links', 'tsl_plugin_action_links', 10, 2 );

function tsl_admin_bar_link() {
global $wp_admin_bar;
if ( !is_super_admin() || !is_admin_bar_showing() )
return;
$wp_admin_bar->add_menu( array(
'id' => 'tsl_admin_bar',
'parent' => 'appearance',
'title' => __( 'The Social Links'),
'href' => admin_url( 'themes.php?page=the-social-link' )
) );
}

function tsl_admin_bar_init(){
add_action('admin_bar_menu', 'tsl_admin_bar_link', 70);
}
add_action('admin_bar_init', 'tsl_admin_bar_init');

?>
#center #links #social
  • Profile picture of the author ussher
    add this to your css file:

    #the-social-link-widget-3 {
    text-align: center;
    }
    Signature

    "Jamroom is a Profile Centric CMS system suitable as a development framework for building entire communities. Highly modular in concept. Suitable for enterprise level development teams or solo freelancers."

    - jamroom.net
    Download Jamroom free: Download
    {{ DiscussionBoard.errors[6076801].message }}
  • Profile picture of the author Taniwha
    Don't worry, got it fixed! thanks Ussher
    {{ DiscussionBoard.errors[6081203].message }}

Trending Topics