Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Good grief this is ridiculous! (URLs)

I’ve had a read through some of that (brain’s worn out!) but I don’t want to force all links to open new windows, just some to external sites. Users can go external, have a read, then close that window to return to my forum. So something like;

Click here

As none of the members know bbcode it’ll only be me doing it. Well, if I could get it working. Hmm… Sam’s code on one of those threads does it pre-post, so I guess that would work, unless I linked to another post, which I don’t want in a new window.

Ok, so… I added the following code from another post to my bb-tweaks.php;

// add nofollow to externa links only
function target_nofollow_external_only( $text ) {
$domain="travel-writers-exchange.com"; // domain to exclude from target and nofollow
// Strip ALL nofollow
$text = preg_replace('|<a>|iU','</a><a>', $text);
// Add back in when needed
$text = preg_replace('|</a><a>]+http://))(?!([^>]+'.$domain.'))(.+)>|iU', '</a><a rel="nofollow">', $text);
return $text;
}
add_filter('post_text', 'target_nofollow_external_only',999);

It stops my links from working somehow. They highlight, but don’t do anything when clicked. (Try http://mbforum.letsdoo.org/topic/if-your-web-browser-drives-you-mad).

Skip to toolbar