Jump to content


Photo
- - - - -

Add Sharebar to end of post excerpt

sharebar post-excerpt

Best Answer MissT , 19 June 2013 - 09:03 AM

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)]');
    
}

Go to the full post


  • Please log in to reply
5 replies to this topic

#1 MissT

MissT

    Super Member

  • Members


  • 233 posts
  • LocationUK
  • Country: Country Flag

Posted 17 June 2013 - 03:16 PM

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! :)



#2 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 17 June 2013 - 03:51 PM

Hi,

 

I'd not know the code for Sharebar, and our moderating team are not developers, so you'd

Please Login or Register to see this Hidden Content

for that. However, you might be able to use the shortcodes from

Please Login or Register to see this Hidden Content

  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.



#3 MissT

MissT

    Super Member

  • Members


  • 233 posts
  • LocationUK
  • Country: Country Flag

Posted 19 June 2013 - 09:03 AM   Best Answer

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=

Please Login or Register to see this Hidden Content

]');
    echo do_shortcode('[twitter_button]');
    echo do_shortcode('[pinterest img=url(optional)]');
    
}



#4 greenfly

greenfly

    Advocate

  • Members

  • 3268 posts
  • LocationManchester, England
  • Framework Version:latest
  • Country: Country Flag

Posted 19 June 2013 - 01:08 PM

Thanks for letting us know MissT 



#5 Amy E

Amy E

    Newbie

  • Members
  • 8 posts
  • Country: Country Flag

Posted 09 July 2013 - 06:43 PM

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



#6 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 09 July 2013 - 06:56 PM

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.