Social Media Feather

How to use it

Install and activate Social Media Feather.

Go to Settings / Social Media.

Detick show credit.

Choose the icon size (usually 24×24 is fine).

Choose your service providers.

To use it through PHP, use:

echo do_shortcode('[feather_share]');

How to use your own Social Media Feather icons

Let’s change the facebook icon.

Create the folder my_theme/images/48×48

Name your facebook icon facebook.png and put it there.

Now add in your functions.php the following code.

/*
 * replace icons in Social Media Feather with custom icons
 * @ref: http://wordpress.org/plugins/social-media-feather/
 */

add_filter('synved_social_skin_image_list', 'custom_social_feather_icons');

function custom_social_feather_icons($image_list) {

    // set up file and URI paths
    $path = get_template_directory() . '/images';
    $baseURL = get_template_directory_uri() . '/images';

    // get list of sizes
    $dirs = glob($path . '/*', GLOB_ONLYDIR);
    $dirs = array_map('basename', $dirs);
    $sizes = array();

    foreach ($dirs as $dirname) {
        $parts = explode('x', $dirname);

        if (!empty($parts[0])) {
            $sizes[] = (int) $parts[0];
        }
    }
    sort($sizes, SORT_NUMERIC);

    // search path for icons replacing the regular icons
    foreach (array_keys($image_list) as $site) {
        $icons = array();
        foreach ($sizes as $size) {
            $imagepath = "$path/{$size}x{$size}/$site.png";
            if (file_exists($imagepath)) {
                $icons[$size] = array(
                    'name' => "{$size}x{$size}",
                    'sub' => "/$site.png",
                    'path' => $imagepath,
                    'uri' => "$baseURL/{$size}x{$size}/$site.png",
                );
            }
        }

        if (count($icons) > 0) {
            $image_list[$site] = $icons;
        }
    }

    return $image_list;
}

?>

Post A Comment

Anti-Spam Quiz: