Add Social Media Icons To Genesis (Without a Plugin)

KAR - 2022

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

12 Comments

  1. 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!

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

Leave a Comment

Your email address will not be published. Required fields are marked *