X | The Theme: How do you add social sharing buttons after the post content?

0
0

Adding the following code to the x-theme child theme’s function.php file worked for me.

// Add Social Sharing after the single post content
// =============================================================================

function x_add_social_sharing ( $content ) {
  if ( is_singular('post') ) {
    echo do_shortcode('[share title="Share this Post" facebook="true" twitter="true" linkedin="true" pinterest="true" reddit="true" email="true"]');
  }
}
add_action('x_before_the_content_end', 'x_add_social_sharing');

The code above is a variation of a solution I obtained from an old theme.co forum, and, though it worked for me, the forum notice says that it is no longer supported.  The variation I made was to remove Google+ from the shares. A link to the forum  post follows:

https://theme.co/apex/forums/topic/adding-social-share-buttons-to-all-posts/

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website