Add Social Media Icons To Genesis (Without a Plugin)

99% of social media plugins are crap. Many are poorly coded, and some only exist as a way to advertise inside the WordPress dashboard. If you’re not comfortable with code, then I would recommend trying Jetpack Sharing.

Otherwise, the code below is what I use (when I don’t use Jetpack).

The following will add the horizontal Facebook, Twitter, Google Plus, Pinterest, Pocket, StumbleUpon, LinkedIn, and Reddit icons above each post. Add the following code to functions.php:

https://gist.github.com/gregrickaby/5292781

Some basic styles:

https://gist.github.com/gregrickaby/5607546

Advanced

If you want to move the icons underneath a post, change the action hooks.

add_action( 'genesis_before_entry', 'child_social_media_icons', 5 );

to this:

add_action( 'genesis_after_entry', 'child_social_media_icons', 5 );

If you want the icons to appear on both posts AND pages, but not the homepage?

if ( is_single() ) { ?>

to this:

if ( !is_front_page() ) { ?>

To learn more about conditional tags, visit http://codex.wordpress.org/Conditional_Tags

About Greg Rickaby

Director of Engineering @WebDevStudios / Author & Tech Editor @ForDummies / @WordPress Contributor / @gatsbyjs Maintainer / Follow Greg on Twitter

12 Comments

  1. Mitch Bartlett on August 11, 2013 at 11:57 am

    Thanks for this. Just got it up and going on my new Genesis 2 site. Simply copy and paste worked flawlessly.

  2. Adam Kayce on August 15, 2013 at 11:20 am

    I couldn’t get it to work at first, until I switched out the genesis_before_post_content hook with the new HTML5 hook, genesis_entry_content. Then, it was flawless. Thanks!

    • Tifanie on October 15, 2013 at 4:11 pm

      Thanks for this, Greg. And thanks Adam – that’s what I was trying to figure out.

    • Serdar A. on October 18, 2013 at 5:07 pm

      Hey Adam, I find solution for HTML5. Try this!
      add_action( ‘genesis_after_entry’, ‘child_social_media_icons’, 5 );
      This works on my site.

  3. lemonthirst on October 16, 2013 at 4:34 am

    Thank you!

  4. Jenni on December 17, 2013 at 2:47 pm

    Awesome, awesome. Thank you so much! This works perfectly.

  5. mediacellar on January 22, 2014 at 5:17 pm

    Is it necessary to change “genesis_before_post_content” to “genesis_before_entry_content” with HTML 5 layouts?

  6. james on August 7, 2014 at 9:28 am

    Thanks for this awesome tip. Work perfectly in my Genesis Theme

  7. Funvblog on October 30, 2014 at 8:11 am

    Thanks for sharing, I will sure try on my genesis powered blog which will help us to spread our blog to the world.

  8. toko qceng on November 23, 2015 at 8:02 pm

    really is very nice

  9. victor on July 17, 2017 at 9:24 pm

    Thank’s so much for taking the time to share your knowledge ….

  10. nobasil4hire on November 22, 2017 at 3:50 pm

    Thanks!

Leave a Comment