Add Social Share Buttons to the Blog summary

Hi,

I have a quick question, please.

How can I add social links to the Blog summary area as below, please. You guys helped me to add Social share buttons to the blog post through the code in the functions.php. Is there a way to modify it to my requirement please?

Many thanks

// Add Share Buttons
// =============================================================================

add_action(‘x_before_the_content_end’, function() {
if ( is_singular(‘post’) ) {
echo do_shortcode(’[share title=“Share this Article” facebook=“true” twitter=“true” linkedin=“true” google_plus=“true” email=“true”]’);
}
});

Hi There,

Try this:

add_action('the_excerpt', 'sharing_buttons', 99999);
add_action('x_before_the_content_end', 'sharing_buttons',999);
function sharing_buttons($content) {
    if(is_home()){
      echo $content.do_shortcode('[share title="Share this Article" facebook="true" twitter="true" linkedin="true" google_plus="true" email="true"]');
    }
    if ( is_singular('post') ) {
      echo do_shortcode('[share title="Share this Article" facebook="true" twitter="true" linkedin="true" google_plus="true" email="true"]');
    }
}

For more information, please check this: https://codex.wordpress.org/Conditional_Tags

Hope this helps.

Hi Lely,

Thank you so much. It really worked.

May I ask another question please. This is in relation to the excerpt content size. I have set the blog excerpt length to 60 but there is a inconsistency of the length visually. Or is it possible to specify the no of characters rather than the words?

Please see the screenshot. Could you please help to fix it please.

Here’s the link. You will see what I mean: http://charistek.com/emovyz/

Many thanks

Hi There,

You’re always welcome!

By default it is counting words. Please check this: http://smallenvelop.com/limit-post-excerpt-length-in-wordpress/

Hope this helps.

Thanks Lely

On behalf of my colleague, you’re welcome. Cheers! :slight_smile:

Hello, I would like to do the same, to the blog summary and to the classic blog post, but I don’t know how to code. Is there a simple way to do it ? :slight_smile:

Hey @thecelinette,

Another way to do this would be through third party plugins. However, we cannot provide a specific suggestions on which social share plugins since this is something that goes beyond the scope of our support.

You might get some ideas from this search result:

https://tinyurl.com/ukq7qop

Hope this helps.