Posted By

ederwp on 04/29/13


Tagged

wordpress hacks twitter


Versions (?)

Automatically link Twitter usernames in WordPress


 / Published in: PHP
 

Automatically link Twitter usernames in WordPress - Paste the code into the functions.php of your theme

  1. /* Automatically link Twitter usernames in WordPress*/
  2.  
  3. function twtreplace($content) {
  4. $twtreplace = preg_replace('/([^a-zA-Z0-9-_&])@([0-9a-zA-Z_]+)/',"$1<a href=\"http://twitter.com/$2\" target=\"_blank\" rel=\"nofollow\">@$2</a>",$content);
  5. return $twtreplace;
  6. }
  7.  
  8. add_filter('the_content', 'twtreplace');
  9. add_filter('comment_text', 'twtreplace');

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: jordanhuxley on August 23, 2013

Could the same be achieve for stock symbols (e.g. $MFST) with Bloomberg or Yahoo Finance?

You need to login to post a comment.