Are you looking for a way to convert URI, WWW, FTP, and email addresses into clickable links? While there’s probably a plugin for this, we have created a quick code snippet that you can use to convert URI, WWW, FTP, and email addresses into clickable links within within the_content
and the_excerpt
.
Instructions:
All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:
add_filter('the_content', 'make_clickable'); add_filter('the_excerpt', 'make_clickable');
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: 7 best WordPress poll plugins to grow onsite engagement and how to add a portfolio to your WordPress site.
All these old comments made me not want to give this a try -I thought maybe it may be outdated but its working nicely now in 2019.
Thank you!
I need an external link to “Read more” (example) at the end of an excerpt that links to the external site where the article was posted. I used WP “Press This” to create the post but it links to the post under my site’s permalink. I have tried everything. Creating the post in “Press This” does include a via (and then article name linked to article URL) but it doesn’t show up anywhere else when posted on my home page as a post.
This doesn’t seem to work on my template. What could be wrong? I’ve only used the_excerpt snippet, do I have to use them both?
Thanks!
Try placing make_clickable(get_the_content) or the_excerpt within your template and see if that will work for you.
Hey, this is a cracking bit of code, how could I add this to a custom metabox.
Hey glad you like the snippet, what you could do is wrap the make_clickable() around your content in your template. Rather then above you could do make_clickable(get_the_content()); so you could do something like that.
[…] Appliquer la fonction “make_clickable” à tous les contenus pour rendre URL et adresses … addthis_url = 'http%3A%2F%2Fwww.yann.com%2Ffr%2Fdeux-fonctions-de-traitement-de-texte-wordpress-bien-pratiques-16%2F06%2F2011.html'; addthis_title = 'Deux+fonctions+de+traitement+de+texte+WordPress+bien+pratiques'; addthis_pub = ''; […]