Social Media Sharing Above Featured Image

Hey,
on my site


I’d like to have some social media icons for sharing between the h1 and the featured image. How can I do that?
Thanks!

Hi there,

To add the Social Media icons on the single post page you will need customization of the theme as our theme does not have the functionality out of the box. Implementing this customisation is outside of our support scope, but we will do our best to give you a get started guide which you will then implement the feature yourself.

To do this customization you will need to install the Child Theme. After that, you need to add the code below to the functions.php file of the Child Theme:

// 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" google_plus="true" linkedin="true" pinterest="true" reddit="true" email="true"]');
  }
}
add_action('x_before_the_content_end', 'x_add_social_sharing');

The code about will make use of the share button shortcode and add it in the single posts. You can customize the shortcode to add the social icons you like.

For more information:


Thank you.

Thanks a lot,
just a quick question about that:
with “x_before_the_content_start” I got the social media share icons working below the featured image. But I want the share icons above the featured image. How can I get them a position higher?
Thanks!

Hey @awecesar,

X does not have x_before_the_content_start hook. Do you mean x_before_the_content_begin. If so, that is below the featured image. There is no hook specifically located above the featured image. So for that, you need to put your extra code above the content template file which is content.php located in x\framework\views\ethos. You can override that in a child theme.

Thanks.

Thanks!
Just one little error, otherwise it’s working!
(See screenshot)

Hi there,

That is just a warning. You may remove it if you disable the WP_DEBUG in the wp-config.php file.

My debugging is disabled (see screenshot) at least in the wp-config in the highest level of my installation of wordpress
What should I do?

Hello There,

Please have the code updated and use this instead:

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

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

Hope this helps. Kindly let us know.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.