Blog

The Haycroft Media Blog covers all aspects of website design and development from the web browsers being used through to the standards that govern the world wide web. As a website design and development company, it is imperative that we keep abreast of all the latest news and happenings in our field, and here we present the major stories along with tutorials, tips and other web-programming related items.

TwitterTools – open links in external window

UPDATE: Having updated the plugin several times, I have realised the folly of the suggestions below as they get over-written each time (DOH). Fortunately my increasing use of jQuery threw up a really simple solution, simply add this to your header and Hey Presto! all your twitter tools links will now have ‘target=”_blank”‘ added to them.

<script>
	jQuery(function($) {
		$("div.aktt_tweets a" ).attr('target', '_blank');
	});
</script>

Our site makes use of the Twitter Tools plugin, but with some minor tweaks

The only links that Twitter Tools displays with our set-up are the bit.ly links, the link to the specific tweet (e.g. “1 hr ago”) and the “More Updates…” link. All of these links will open their target in the same window, but we wanted them to open an external window so the user remains on the site.

To do this, you need to locate the plugin’s main coding. This is currently at:
wp-content/plugins/twitter-tools/twitter-tools.php

Now make the folllowing changes:

“More Updates Link”: Change Line 812:

$output .= '	<li class="aktt_more_updates"><a href="'.aktt_profile_url($aktt->twitter_username).'">'.__('More updates...', 'twitter-tools').'</a></li>'."\n";

To:

$output .= '	<li class="aktt_more_updates"><a href="'.aktt_profile_url($aktt->twitter_username).'" target="_blank">'.__('More updates...', 'twitter-tools').'</a></li>'."\n";

“Time Display Link”: Change Line 879:

$output .= ' <a href="'.aktt_status_url($aktt->twitter_username, $tweet->tw_id).'" class="aktt_tweet_time">'.$time_display.'</a>';

To:

$output .= ' <a href="'.aktt_status_url($aktt->twitter_username, $tweet->tw_id).'" class="aktt_tweet_time" target="_blank">'.$time_display.'</a>';

“Bit.ly links”: Change Line: 881:

return $output;

To:

$output = str_replace('rel="nofollow">', 'target="_blank" rel="nofollow">', $output);
return $output;
[ Back ]

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Facebook Comments