How to add social media icons in blog post preview

Hi ya’ll ! I’m wondering if I can put social media sharing buttons in my post meta like in this site here and a category link.

Thank you in advance!

http://thedaoofaction.com/ . <-- here is my site currently

Hey,

You should try this article`s workaround: https://theme.co/apex/forums/topic/post-metasocial-media-share-buttons/

it says the page no longer exists or is private

Hello There,

Thanks for writing in!

Since your child theme is set up, please add the following code in your child theme’s functions.php file

// Add social sharing icons
// =============================================================================
function add_excerpt_social_sharing_icons ( $content ) {
  echo do_shortcode('<div style="margin: 20px 0;">[x_share title="Share this Post" facebook="true" twitter="true" google_plus="true" linkedin="true" pinterest="true" reddit="true" email="true"]</div>');
}
add_action('x_before_the_excerpt_end', 'add_excerpt_social_sharing_icons');
// =============================================================================

This code will add the sharing icons right below the excerpts.

Please let us know how it goes.

Awesome It works! thank you!

You’re welcome!
We’re glad we were able to help you out.

How do I add the social share buttons to the blog post as well? On the individual blog post page

Thanks!

Hi There @emwillett

You can try updating the code as follows.

function x_add_social_sharing() {
  if ( (!is_front_page() && is_home()) || is_single() ) {
    echo do_shortcode('[x_share title="Share this Post 1" facebook="true" twitter="true" google_plus="true" linkedin="true" pinterest="true" reddit="true" email="true"]');
  }
}
add_action('x_before_the_excerpt_end', 'x_add_social_sharing');
add_action('x_before_the_content_end', 'x_add_social_sharing');

Hope that helps.

Thank you this worked!

You’re welcome, glad we could help.

Cheers!