WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Facebook: Open Graph, Rich Pin, Twitter Card, SEO, and Schema Meta Tags
[resolved] Social icons on home page under excerpt? (6 posts)

  1. cikorka
    Member
    Posted 11 months ago #

    Hello,

    I love your plugin, it works great :).

    I was just wondering whether it is possible to have social buttons show under the posts' excerpts on home page? I tried using `<?php if ( function_exists( 'ngfb_get_social_buttons' ) )
    echo ngfb_get_social_buttons( array( 'facebook', 'gplus', 'twitter' ) ); ?>` in my loop, and it looked OK, but I then noticed the data is the same on all the posts on one page - for example: the first post has 8 likes -> it shows 8 likes on all the posts below the first one, although they don't really have the same number of likes. Does that make any sense :)?

    The page is endurance.si.

    Thank you for your help :)!

    http://wordpress.org/extend/plugins/nextgen-facebook/

  2. JS Morisset
    Member
    Plugin Author

    Posted 11 months ago #

    Nice one!

    By default NGFB will use the URL for the current webpage, which is an index, so you'll have to tell it which URL to use. Try something like this:

    <?php
    if ( function_exists( 'ngfb_get_social_buttons' ) )
      echo ngfb_get_social_buttons(
        array( 'facebook', 'gplus', 'twitter' ),
        array( 'url' => get_permalink( $post->ID ) )
      );
    ?>

    You could also add the following to your theme's functions.php file:

    add_filter( 'the_excerpt', array( 'ngfbPlugin', 'add_content_buttons' ) );

    I *think* that should work...

    Hm. This could easily be a checkbox option on the settings page... I'll try and keep it in mind for the next version. ;-)

    js.

  3. cikorka
    Member
    Posted 11 months ago #

    Yay, I'm loving this plugin and its technical support more and more :).

    I've tried both solutions: the code in the loop works like a charm :).

    The other option (adding the filter to functions.php file) renders a parsing error (Parse error: syntax error, unexpected ';' in /home/MySite/public_html/wp-content/themes/endurance-yoko/functions.php on line 367) though.

    Love the idea of having the option on the settings page :)!

    Thank you so much & have a wonderful day :)!

  4. JS Morisset
    Member
    Plugin Author

    Posted 11 months ago #

    I wasn't going to include any new features in 5.0, but what the heck, I sat down for a few hours this morning and wrote the code to include social buttons in the excerpt.

    Would you mind testing it and letting me know if everything works as expected?

    http://downloads.wordpress.org/plugin/nextgen-facebook.5.0rc2.zip

    Thanks,

    js.

  5. cikorka
    Member
    Posted 11 months ago #

    This is why I love WordPress - because of all the people who make it the warmest and most user-frienly platform out there :).

    It works perfectly. Thank you, jsmoriss :)!.

  6. JS Morisset
    Member
    Plugin Author

    Posted 10 months ago #

    FYI - There was a small recursion issue with the new excerpt button filter. Download and install the new 5.0rc3 version.

    http://downloads.wordpress.org/plugin/nextgen-facebook.5.0rc3.zip

    Thanks,

    js.

Reply

You must log in to post.

About this Plugin

About this Topic