Results 1 to 9 of 9
Threaded View
-
18th Mar 2011, 11:51 PM #9OPMember
@Hillsid3 : Thx for the try
Got the prefect solution Enjoy using it
Hey finally i have something that works ... All links inside quote opens in a new window ( _blank )
Edit your themes functions.php and add the following inside <?php ..... ?>
add_action('init','buffer_output_for_links');
function buffer_output_for_links() {
if (!is_admin()) // No need to do in the admin
ob_start('decorate_links');
}
function decorate_links($content) {
$wpurl = get_bloginfo('wpurl');
$parts = explode('<a',$content);
for($index = 1; $index<count($parts); $index++) {
// Break apart on '>' to isolate anchor attributes
$part = explode('>',$parts[$index]);
// Remove all target="_blank"
$part[0] = preg_replace("#\\s*target\\s*=\\s*[\"'].*?['\"]\\s*#",' ',$part[0]);
// Add target="_blank" to all
$part[0] = preg_replace('#href\s*=\s*#','target="_blank" href=',$part[0]);
// Remove target="_blank" from only this domain
$part[0] = preg_replace("#target=\"_blank\" href=(['\"]){$wpurl}#","href=\\1{$wpurl}",$part[0]);
// End this part by reassembling on the '>'
$parts[$index] = implode('>',$part);
}
// Finally reassembling it all on the '<a' leaving a space for good measure
$content = implode('<a ',$parts);
return $content;
}
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Wordpress Blockquote Style?
By aKaK in forum WordpressReplies: 6Last Post: 12th Jun 2012, 05:30 PM -
Wordpress Article Fetch [Aka Wordpress leecher!]
By S?nic in forum Webmaster ResourcesReplies: 2Last Post: 11th Apr 2012, 06:48 PM -
Wordpress error when disable Wordpress Seo by Yoast
By chipve in forum Webmaster DiscussionReplies: 8Last Post: 8th Jul 2011, 07:11 PM -
[Hiring] Expert Wordpress Coder (Wordpress Guru)
By MasterDKR in forum Completed TransactionsReplies: 0Last Post: 2nd Aug 2010, 05:07 PM -
[Buying] Wordpress to Wordpress Post Leecher
By gcs89 in forum Completed TransactionsReplies: 1Last Post: 23rd Jul 2010, 11:45 PM
themaCreator - create posts from...
Version 3.57 released. Open older version (or...