Egy újabb örvendetes apróság.
Senki sem szereti, ha a látogató elhagyja az oldalunkat.
Ha a kommentek között szerepel egy bemásolt url, akkor azt a wp alaphelyzetben a saját ablakában nyitja meg, ezáltal az olvasó le is lépett tőlünk.
Ez a plugin nemes egyszerűséggel minden ilyen url-t új ablakba nyit meg, így megmarad a káposzta is, és a kecske is jóllakik!
/*
Plugin Name: Target Blank In Posts And Comments
Plugin URI: http://www.inverudio.com/programs/WordPressBlog/NewTabWindowTargetBlankPlugin.php
Description: Keep your visitors. Inserts target="_blank" into post and comment content URLs and external links will open in new tabs. Lazar blatantly stole the code from Kaf Oseo's 'Nofollow In Posts' plugin, and replaced rel="nofollow" with target="_blank".
Version: R1.0.1
Author: Lazar Kovacevic
Author URI: http://www.inverudio.com
Copyright (c) 2006 Kaf Oseo (http://szub.net)
Target Blank In Posts URLs is released under the GNU General Public
License (GPL) http://www.gnu.org/licenses/gpl.txt
This is a WordPress plugin (http://wordpress.org).
Props to kubicka and Kaf.
*/
function target_blank_in_posts($text) {
$text = preg_replace('%<a(s+.*?href=S(?!' . get_bloginfo('home') . '))%i', '<a target="_blank"1', $text);
return $text;
}
//put blanks in post links
add_filter('the_content', 'target_blank_in_posts', 42);
//put blanks in comments links
add_filter('comment_text', 'target_blank_in_posts', 42);
?>
http://www.inverudio.com/programs/WordPressBlog/NewTabWindowTargetBlankPlugin.php