20.04.2007, 16:07
|
#12 (permalink)
|
| PostRank: 0
Registriert seit: 05.04.2007
Beiträge: 6
| So, ich habe das Problem nun selbst gelöst und den PHP-Code entsprechend angepasste. Für Leute die das interessiet:
Schritt 1.: Ein neue Funktion basteln die alles was mit http, https oder www anfängt in Links ändert -> wp-includey/formatting.php PHP-Code: function autoFormatAchor($text) {
$text = preg_replace("=(^|\ |\\n)(http:\/\/|https:\/\/|http:\/\/|ftp:\/\/)([a-zäöüéèàA-ZÄÖÜÉÈÀ0-9\.\/\-\_]{1,})=i", "\\1<a href=\"\\2\\3\" target=\"_blank\">\\2\\3</a>", $text);
$text = preg_replace("=(^|\ |\\n)(www\.)([a-zäöüéèàA-ZÄÖÜÉÈÀ0-9\.\/\-\_]{1,})=i", "\\1<a href=\"http://\\2\\3\" target=\"_blank\">\\2\\3</a>", $text);
return $text;
}
2. und letzter Schritt: Einbinden der Funktion. So wird der Content eines Beitrags durch die Funktion gejagt -> wp-includes/default-filters.php PHP-Code: add_filter('the_content', 'autoFormatAchor');
Fertig. Danke trotzdem an alle für Eure Bemühungen! |
| |