Created
February 14, 2014 14:15
-
-
Save seoagentur-hamburg/9001685 to your computer and use it in GitHub Desktop.
Verlinkt automatisch alle Twitter-Usernamen im Inhalt und auch im Excerpt, sowie den Kommentaren.<
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function tweetlink($content) { | |
$tweetlink = preg_replace('/([^a-zA-Z0-9-_&])@([0-9a-zA-Z_]+)/',"$1<a href=\"http://twitter.com/$2\" target=\"_blank\" rel=\"nofollow\">@$2</a>",$content); | |
return $tweetlink; | |
} | |
// The content | |
add_filter('the_content', 'tweetlink'); | |
// Comments | |
add_filter('comment_text', 'tweetlink'); | |
// Excerpt | |
add_filter('the_excerpt', 'tweetlink'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment