Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Small change to BuddyPress Default 1.2.3 theme

tbh it’s considered a bad thing for developers to do, the opening of new windows is a browser issue and as such it’s considered impolite to force your wishes on the end user. It is my decision as to how I deal with links not yours, if you try and disrupt my browsing habits I’m annoyed; regardless I override anything you might try and do so it’s largely wasted effort your new window becomes a new tab for me.

This action is also a behaviour and as such the use of attributes is rightly deprecated, but they can be added via scripting. You could give the following code a try it would need to be added to a functions.php file in a child theme.


function rss_new_win() {
echo <<<SCRIPT

<!--
function bindNewWin() {
jQuery("li.feed > a").attr({target:"_blank", rel:"ext"});
return false;
}
jQuery(document).ready(function(){
bindNewWin();
});
//-->

SCRIPT;
}
add_action('wp_head', 'rss_new_win');

I can’t vouch for how well this works, it’s tested and works ok but whether it breaks any WP/BP script inclusion rules I’m not familiar with i couldn’t say so it should be used cautiously ; also take note that it adds an attribute to all anchors that have a li parent of class ‘feed’ if that condition is not true then it would fail (the main feed on the activity steam is marked up in this fashion if others exist that are contary then they would need to be added in some manner to this code.

IGNORE THE CODE POSTED HERE IT DOESN’T DISPLAY CORRECTLY grab from this pastebin link if you want to give it a go:
http://pastebin.com/keBUmVxX

Skip to toolbar