Tagged: excerpt, social media
-
AuthorPosts
-
August 13, 2014 at 3:39 pm #303891
Hi, I was wondering if it would be possible to add social media buttons ( I am especially interested in Facebook like count button) in excerpt section on my blog. I am using grid layout.
Marie Forleo has it on her site next to “keep reading” text: http://www.marieforleo.comAddThis Share plugin has the option in advance settings to check the option “Show AddThis on excerpts”, but when I check it, nothing happens.
I would appreciate your help with this.
Thank you.
Lexie.
August 14, 2014 at 12:31 am #304081Hi Lexie,
Open /config-templatebuilder/avia-shortcodes/postslider.php and look for this line:
$prepare_excerpt = !empty($entry->post_excerpt) ? $entry->post_excerpt : avia_backend_truncate($entry->post_content, apply_filters( 'avf_postgrid_excerpt_length' , 60) , apply_filters( 'avf_postgrid_excerpt_delimiter' , " "), "…", true, '');
Replace it by this:
$prepare_excerpt = !empty($entry->post_excerpt) ? $entry->post_excerpt : avia_backend_truncate($entry->post_content, apply_filters( 'avf_postgrid_excerpt_length' , 60) , apply_filters( 'avf_postgrid_excerpt_delimiter' , " "), "…", true, ''); if (function_exists('addthis_display_social_widget')) $prepare_excerpt .= addthis_display_social_widget('');
Regards,
JosueAugust 16, 2014 at 2:22 am #305151Hi Josue, thank you for your help.
Unfortunately I didn’t have a success with this. When I replaced the line, nothing changed.
Then I tried one other plugin that supposedly puts the social media buttons in excerpt but again nothing happened.Are there any other options?
Thanks again.
Lexie.
August 16, 2014 at 2:32 am #305152Hey Lexie!
It tested it on my end and it worked, for addtoany it would be similar:
/config-templatebuilder/avia-shortcodes/postslider.php, line 313:
if ( function_exists( 'ADDTOANY_SHARE_SAVE_KIT' ) ) $prepare_excerpt .= do_shortcode("[addtoany]");
Best regards,
JosueAugust 16, 2014 at 3:00 pm #305297Hi Josue!
Thank you, I tried that code and it does work with ADDTOANY great, but ADDTOANY doesn’t offer a Facebook LIKE COUNT button, which was the point of all of this.I tried it with Addthis again several times but it just doesn’t work, its frustrating. :)
I also use DiggDigg. Maybe it could work with that somehow? Or is there any other plugin that I could use for this that offers Facebook like count?
August 16, 2014 at 3:17 pm #305300Josue I figured it out with Addtoanny, now I have a Facebook count button in my excerpt, but the problem is that it doesn’t pick up on likes from my posts.
Probably because it is a different plugin? – I use DiggDigg and Addthis for my posts.
So 1. Is there any way to fix that? 2. Or is there any way to fix the problem with Addthis plugin not showing up? 3. Or is there a way to make it work with DiggDigg?Thank for your help.
Lexie.
August 16, 2014 at 6:57 pm #305337Hi Lexie!
I’m not familiar with those plugins, and debugging third party plugins is outside of our scope. Basically what you need to do is replace the second line with any [shortcode] or PHP function the plugin offers to make its buttons appear (the function_exists conditional is not mandatory).
$prepare_excerpt = !empty($entry->post_excerpt) ? $entry->post_excerpt : avia_backend_truncate($entry->post_content, apply_filters( 'avf_postgrid_excerpt_length' , 60) , apply_filters( 'avf_postgrid_excerpt_delimiter' , " "), "…", true, ''); $prepare_excerpt .= "SOMETHING";
Also, you have access to the permalink and title, so you can even build your own social share links:
$prepare_excerpt .= get_permalink($the_id).get_the_title($the_id);
For example, to get the like count button:
$prepare_excerpt .= '<iframe src="//www.facebook.com/plugins/like.php?href='.get_permalink($the_id).'&width&layout=button_count&action=like&show_faces=false&share=false&height=21&appId=217816428346969" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:21px;" allowTransparency="true"></iframe>';
Best regards,
JosueAugust 26, 2014 at 12:45 am #309023Hi Josue,
I will try this if I manage. :) I am not so good with codes. I will try to find someone to help me.
Thank you for your help and support.
Kind regards,
Lexie.
-
AuthorPosts
- The topic ‘Social media buttons in excerpt section bellow or next to read more’ is closed to new replies.