Greg Rickaby

Greg Rickaby

Full-Stack Engineer / Photographer / Author

Add Social Media Icons To Genesis (Without a Plugin)

Posted on | 1 minute read

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

Comments

No comments yet.

Mitch Bartlett

Mitch Bartlett

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

Adam Kayce

Adam Kayce

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

Tifanie

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

lemonthirst

lemonthirst

Thank you!

Serdar A.

Serdar A.

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

Jenni

Jenni

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

mediacellar

mediacellar

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

james

james

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

Funvblog

Funvblog

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

toko qceng

toko qceng

really is very nice

Leave a Comment