Skip to content

☘ Social sharing & counts for all major networks. ☘

Notifications You must be signed in to change notification settings

vielhuber/socialfoo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

☘ socialfoo ☘

socialfoo adds social sharing including counts to any website for all major networks.

networks

benefits

  • gdpr compliant
  • no dependencies
  • includes basic styling
  • multiple layouts available
  • caches counts for fast loading
  • support for facebook share count
  • no developer accounts needed (except facebook)

requirements

installation

download and extract master.zip inside a new folder called socialfoo.

then add the main script to your website:

<script src="socialfoo/socialfoo.js"></script>

if you need basic styling, also add this:

<link rel="stylesheet" href="socialfoo/socialfoo.css" />

finally exclude the cached counts in your .gitignore:

socialfoo/socialfoo.txt

if socialfoo is not able to determine the path of the php script, provide it in socialfoo.js:140.

usage

plain html

<div
    class="socialfoo socialfoo--grid|socialfoo--toggle"
    data-url="http://ard.de"
    data-title="Das ist der Inhalt des Posts"
    data-image="https://vielhuber.de/wp-content/themes/vielhuber/images/about.jpg"
></div>

wordpress

echo '<div class="socialfoo socialfoo--grid|socialfoo--toggle" ';
echo 'data-url="' . get_permalink() . '" ';
echo 'data-title="' . get_the_title() . '" ';
if (has_post_thumbnail(get_the_ID())) {
    echo 'data-image="' . wp_get_attachment_url(get_post_thumbnail_id(get_the_ID())) . '" ';
}
echo '></div>';

special pinterest content

add the following data attributes to provide special pinterest content:

data-pinterest-image="https://vielhuber.de/wp-content/themes/vielhuber/images/about.jpg"
data-pinterest-description="Das ist der Inhalt des Posts"

facebook share count

facebook changed its graph api several times in the past. currently it is only possible to gather any data (including the share count) with a working access token. obtaining and integrating such a token is straightforward:

  • login at https://developers.facebook.com
  • create a new app
  • in the settings provide a link to a public privacy page and choose a category
  • publish the app in the top right corner
  • add your app id and your app secret into socialfoo/socialfoo.php (line 7-8)

About

☘ Social sharing & counts for all major networks. ☘

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published