Recently I have integrated my blog with Twitter. Then started to use the Shareaholic plugin for my Firefox to post URLs to Twitter as I surf.

I noticed that though Twitter converts the plain text URLs to clickable links while displaying on Twitter, links were not coming up as links but as plain text URLs in my WordPress posts.
So I installed the Linked WordPress plugin, but unfortunately it was not handling links correctly - only the domain part of each URL was converted to a link. (Now with each URL pointing tohttp://tinyurl.comdoes not look too pro, does it? :) )

After spending some time by checking the plugin’s code, I have found a solution that works for me.
I changed linked/linked.php on line 200, from

$content = preg_replace(’((>|\s)(http:\/\/[a-zA-Z0-9]+(\.[a-zA-Z_]+)+))’, ‘<a href=”$2″>$2</a>’, $content);

to

$content = preg_replace(’((>|\s|\(|\n|\r)(http:\/\/[a-zA-Z0-9]+(\.[a-zA-Z_]+)+([a-zA-Z0-9\/]+))
(\s|\)|\n|<))’ , ‘<a href=”$2″ target=”_blank”>$2</a>’, $content);

This did the trick for me, and now the complete URL is converted to a clickable link…

Experiment & enjoy!
(Download the source file from here: Linked WordPress plugins linked.php zipped)

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Something to say?

You must be logged in to post a comment.