Make Content Clickable In WordPress
Wordpress has a great feature I've just discovered which allows you to convert plain text into links for URLs or email addresses.
If your content has URLs in the content but you haven't add the link you can use this WordPress function to convert all plain text URLs to be links.
The WordPress function you need to use is called make_clickable().
This accepts one parameter which should be a string of the text you want to convert.
It will be able to convert a number of different types of links:
- URLs - Adds link to the URL
- www - Adds link to the www link
- FTP - Adds link to the ftp link
- Email - Adds a link with a mailto around the email address
<?php $string = "This is a long text that contains some links like http://www.wordpress.org and http://www.wordpress.com ."; echo make_clickable($string); ?>
Learn how to code with Treehouse
- Learn projects with access to 1000+ videos
- Practice live with our Code Challenge Engine
- Get help in our members-only forums
- Access 100s of premium tutorials and downloadable content
- Members content consists of premium WordPress plugins
- CSS packages, jQuery packages, tutorial demo files and templates for 100s of web development tutorials
- In-depth development tutorials
- Priority tutorial requests
- No ads