Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #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.com

    AddThis 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.

    #304081

    Hi 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,
    Josue

    #305151

    Hi 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.

    #305152

    Hey 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,
    Josue

    #305297

    Hi 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?

    #305300

    Josue 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.

    #305337

    Hi 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,
    Josue

    #309023

    Hi 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.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Social media buttons in excerpt section bellow or next to read more’ is closed to new replies.