Add Link to Excerpt
-
Great plugin! Is it possible to add the Facebook link to the excerpt itself… so the user can click the text to go to the Facebook post?
-
Hi there, you mean like a “read more” link. Like WordPress excerpts? Not possible yet but good suggestion!
Kind of. I meant the ability to click the excerpt itself. But a “read more” link would be great.
Is this not possible due to Facebook restrictions? Or is it something I could look at if I was pointed to the correct place in the script?
Right now, people can click the timestamp or the likes and comment count to go to the post on Facebook. So it’s definitely possible.
I will implement a way to add a “read more” link (or any text you want) in the next version of the plugin.
If you know your way around PHP you could add this yourself in the plugin files but it will be overwritten on the next plugin update. My suggestion would be to wait a few days until I get the next update ready. π
Great, thank you! That’s really helpful.
I totally agree with kjh290984 – superb plugin. But the read-more possibility is missing. If thats contained in an near-up-coming update – iβll definitely will send money π
Hi guys, just added this to the plugin. The way you change the “read more” is similar to the default WordPress excerpt.
You can add the following snippet to your theme
functions.phpfile.function my_rfbp_read_more($more, $link) { return '<a href="'. $link . '">Read more Β»</a>'; } add_filter('rfbp_read_more', 'my_rfbp_read_more', 10, 2);Note that this will only append the “read more” link to posts that have actually been shortened. If you want to append a “read more” link to all posts, regardless of whether they have been shortened or not, use the following snippet.
function my_rfbp_content($content, $link) { return $content . '<a href="' . $link . '">Read more »</a>'; } add_filter('rfbp_content', 'my_rfbp_content', 10, 2);Thats was fast π
But – dammit – my theme seems to have some kind of function-add-on that removes the extra function.
I installed it with the “Code snippet”-plugin to be sure it was done right. And nothing happens. But if I make the exact same installation on my private homepage it works like a charm…
Besides the function.php-file there is a functions.wp-scripts.php – one of the things it does is:
/**
* Remove a registered script.
*
* @since r16
* @see WP_Scripts::remove() For parameter information.
*/Any suggestions?
I’m not familiar withe the Code Snippets plugin but are you sure you’re adding the function to your theme its functions.php file, located in
/wp-content/themes/your-theme/functions.php?I would just add the filter there manually. Very unlikely that it won’t work that way. π
I tried thats first – but since it didn’t work I thought that maybe I did something wrong. Then I tried the snippet-plugin.
And when THAT didn’t work I tried to make the same installation on a different page with a different theme…and THAT worked…
So it seems to be related to the theme…maybe π
Your update of the plugin solved the problem…I hadβnt seen that you already had done that…sorry for the trouble!
Iβll hurry to paypal π
Ah, so that was the culprit, haha. The filter is only available since version 1.7.3 so that must be it. Glad you figured it out.
Thanks for the (future) donation, appreciate it! A review on the plugin would also make me really happy.
A little add-n, in case someone needs it.
For opening the link in a new tab/page:function my_rfbp_content($content, $link) { return $content . '<a href="' . $link . '" target=_blank >Read more »</a>'; } add_filter('rfbp_content', 'my_rfbp_content', 10, 2);
The topic ‘Add Link to Excerpt’ is closed to new replies.