Support » Plugin: NextGEN Facebook - Social Meta Tags for Facebook, Google, Pinterest, Twitter & More » Social icons on home page under excerpt?
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 :)!
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. 😉
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 :)!
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?
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 :)!.
FYI – There was a small recursion issue with the new excerpt button filter. Download and install the new 5.0rc3 version.
- The topic ‘Social icons on home page under excerpt?’ is closed to new replies.