Archived

This topic is now archived and is closed to further replies.

  • 0

Add Sharebar to end of post excerpt


Question

Posted · Report post

I'd like to add the sharebar to just after the 'Read more' link at the end of a post excerpt on blog page.

 

Do I need to use a hook in the functions.php in order to achieve this or is there another way?  If I do need to add a hook what code do I need to add in addition to...

 

add_action('pagelines_loop_after_excerpt', 'add_end_sharing');
function add_end_sharing() { ?>

 

What goes here!?

<?php }

 

By default the sharing options appear after the post title in the post meta area but I don't like this it looks too cluttered so I'd like to add them at the end of the post instead.

 

Many thanks in advance! :)

Share this post


Link to post
Share on other sites

5 answers to this question

Posted · Report post

This worked in the functions.php of my child theme in case anyone else wants to do the same...

 

add_action('pagelines_loop_after_excerpt', 'add_end_sharing');
function add_end_sharing() {
    echo do_shortcode('[like_button url=http://url-to-like.com]');
    echo do_shortcode('[twitter_button]');
    echo do_shortcode('[pinterest img=url(optional)]');
    
}

Share this post


Link to post
Share on other sites

Posted · Report post

This is great.

How might I tweak it if I'm using the full post content on the blog page rather than excerpts?

Thanks,

Amy

Share this post


Link to post
Share on other sites

Posted · Report post

Thanks for letting us know MissT 

Share this post


Link to post
Share on other sites

Posted · Report post

Amy you'd have to find the correct hook to replace pagelines_loop_after_excerpt as used by MissT.  Try the Action Map plugin to help you find the correct hook.

Share this post


Link to post
Share on other sites

Posted · Report post

Hi,

 

I'd not know the code for Sharebar, and our moderating team are not developers, so you'd need a Pro for that. However, you might be able to use the shortcodes from http://demo.pagelines.me/tools/  I don't recommend using Pinterest there, even with Sharebar as it grabs the post's excerpt and thumb from the post only, not the blog page. The shortcode cannot be set globally for some of them. Facebook is the same, but they do provide some code you can add directly.

Share this post


Link to post
Share on other sites