I’m looking for the same functionality. I’d like any links from Tweets displayed on the Twitter Tools sidebar to open in a new window.
well you can go through and manually modify the code in all the places that a link is being created but, there are a lot of places. You could always use a little jQuery to do the same thing.
<script type="text/javascript">
$(document).ready(function() {
$('div.twitter a[href^="http://"]').attr("target", "_blank");
});
</script>
this is of course assuming you are loading jQuery in the first place and that all your tweets are inside of a div with a class of “twitter”. I think they are by default but I can’t remember. if yours are not, just change the class name in the jQuery code.
This will then add the “target=’_blank'” to all links inside the div.twitter. Far easier than manually editing the plugins code.
Well that worked ! I had to download the latest jQuery and add a call for it too, and I had to change the div class to ‘aktt_tweets’, but after those changes all the links in the sidebar now open in a new window. Thanks a lot for your help.
Spoke too soon, while it did work it also had the unfortunate side effect of breaking my lightbox links everywhere else on my site. I looked in the lightbox plugin code and I dont see any calls to jquery so im not sure why that would have had any effect on it. But as soon as I comment out the call to jquery the lightbox links work again. Back to the drawing board.
i dint see any links that are using lightbox but, admittidly, I didn’t look too hard. It could be because you are calling jQuery twice.
in the top of the head you have
<script type="text/javascript" src="http://www.chaosportal.com/wp-includes/js/jquery/jquery.js?ver=1.2.6"></script>
then at the end of the head you have:
<script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('div.aktt_tweets a[href^="http://"]').attr("target", "_blank");
});
</script>
don’t know if that causes a conflict.
Tugbucket, thanks for the solution. Haven’t had time to try it yet, but from what chaosportal said, I’m sure it will work. No lightbox here, so hopefully I won’t encounter any issues.
Thanks again!
chaosportal – it’s probably because the lightbox is using something other than JQuery (possibly Prototype), which both use the $() operator. Try the following, and replace your calls to $ with j$:
$j=jQuery.noConflict();
$j(document).ready(function(){
});