Home / excerpt / Convert URI, www, ftp, and emails into clickable links
  • How to Convert URI, www, ftp, and emails into clickable links

    convert-uri-www-ftp-and-emails-into-clickable-links

    This is a simple snippet but a gem I have used in several projects. Adding this snippet to the functions.php of your wordpress theme converts URI, www, ftp, and email addresses into clickable links within the_content and or the_excerpt enjoy!

    ( click code to copy )

    wordpress snippet : PHP

    <>
    add_filter('the_content', 'make_clickable');
    add_filter('the_excerpt', 'make_clickable');
    

    ( WordPress codex functions, hooks, in this snippet. )

    the_content, the_excerpt, add_filter, make_clickable, _e, _ex,
  • Pingback: Deux fonctions de traitement de texte WordPress bien pratiques | Yann "Bug" Dubois()

  • 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.

  • 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.

  • 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.