Social Media Buttons Not Appearing in Excerpt
-
Hi,
I am currently using the free version and am experiencing a problem.
The social buttons appear on my post but not in the excerpt (which is what i really need).
Here is a link to the page with the problem.
http://flowsocietylacrosse.com/blog/Thanks in advance for your help.
-
That looks like an index page. You’ll have to enable the “Include on Index Webpages” option.
js.
Hi JS,
Thanks for the speedy reply. (wow!)
I enabled the “Include on Index Webpages” option and experiencing the still the same issue.
Anything else you think might be the problem?
Have you flushed the cache?
js.
Yessir, using the “Clear all cache” button on your plugin’s admin area. Also in my browsers.
Hm. Well, it could be one of two things, and after some digging, I found that it could also be an oversight on my part. 😉
The buttons are hooked into a filter called ‘the_excerpt’, which is similar to ‘the_content’. Almost all developers know about ‘the_content’ filter, but very few know about ‘the_excerpt’. This is fine when a developer uses the built-in WordPress functions, like
the_excerpt()
, which filters the text automatically. But when they access the text directly, they can sometimes forget to run the filters on it.So, one possibility is that they’re accessing the excerpt text directly from
$post->post_excerpt
and forgot to apply the filters.After some digging, I found that the WordPress built-in function
get_the_excerpt()
runs a ‘get_the_excerpt’ filter, and not ‘the_excerpt’. And of course, to make things all standard, a ‘get_the_content’ filter does NOT exist. :-pSo, to recap, if your theme uses
$post->post_excerpt
, your template(s) will have to be updated to useapply_filters('the_excerpt')
on it.I have to look into hooking into ‘get_the_excerpt()’, which is tricky because text can get filtered twice that way. Give me an hour and I should have a new version of the plugin for you to test.
js.
JS, you’re the man.
Incredibly, with all the reading I have done in the last 24 hours I actually get some of what you mean.
Thanks again.. Look forward to testing it out.
Hi Again JS,
Here is a link to another dev’s solution to the same issue on their plugin (Column Posts) some months back, in case it helps you in any way.
I stumbled upon this last night in my search.http://wordpress.org/support/topic/facebook-like-button-in-excerpt?replies=6
I implemented it and it worked, but placed the button (Facebook only) below the title and before the text (i want the buttons after the text).
So although it technically worked, I restored my functions.php and header.php since it wasn’t doing what i actually needed. Upon more searching I came to your page.
30 more mins.
js.
Well. That took a wee bit longer than expected.
It turns out that the output from ‘get_the_excerpt’ is re-filtered through ‘the_excerpt’, which has a bunch of interesting filters from WordPress that add paragraph breaks, etc., which screwed up the social buttons HTML. :p So I had to code *another* filter for ‘the_excerpt’ just to fix the HTML after all the other filters had been applied. 😉
After all this, I really hope your theme uses
get_the_excerpt()
and not$post->post_excerpt
. 😉You can download v6.14dev1 from http://downloads.wordpress.org/plugin/nextgen-facebook.zip.
Give it a go, and let me know if that fixes things for you. If not, then you’ll have to modify your template(s). It’s pretty straight-forward, you can just change this:
$post->post_excerpt
To this:
apply_filters('get_the_excerpt', $post->post_excerpt)
And that should do it. 😉
js.
BTW, once you have things working, don’t forget to leave a review (if you have 2 minutes to spare). 😉
http://wordpress.org/support/view/plugin-reviews/nextgen-facebook
Thanks!
js.
Reading up on your manual install instructions right now. Im still one of those WP Admin install guys..
thanks for your help and effort sincerely.
Will keep you posted..
If you downloaded the NGFB Open Graph+ plugin as an archive file — either the Pro version or from WordPress.org — follow the Automated Removal (if NGFB Open Graph+ is already installed) and the Semi-Automated Install methods to remove, install, and activate the new plugin. Please take care to check the “Preserve on Uninstall” option on the Advanced settings page before removing the plugin (as explained in the Automated Removal procedure).
😉
got it. thanks!
JS,
Works perfectly now man. Thanks so much for your immediate attention to my problem.
Now, since this plug in is the answer to my needs I have a new question (not problem) to ask…
WP asked me to disable 2 conflicting plugins when I first installed yours.
One was FACEBOOK (official plugin) which links my posts to the Facebook page so the posts appear there at the same time. I think I saw a feature in yours that also does this? (so i won’t need FB plugin anymore)
The other was WP SEO plug in.
Im assuming because your plugin handles this things?
Any insight?
The Facebook plugin does a bunch of stuff, along with (mediocre) Open Graph meta tags. The problem is there’s no option to turn off it’s meta tags, so the whole plugin must be deactivated.
WordPress SEO can also add (minimal) Open Graph meta tags. Luckily Yoast offers a way to disable the Open Graph feature, so you can use the rest of the plugin.
NGFB Open Graph+ Pro actually ties-in nicely with WordPress SEO.
js.
- The topic ‘Social Media Buttons Not Appearing in Excerpt’ is closed to new replies.