Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #9325

    Hi!

    Using the Twitter widget as a shortcode on a page.

    How do I get links in the tweets to be targeted to blank?

    Thanks!

    #64367

    Hey Pamino,

    You’ll need to open up class-framework-widgets.php which is inside the framework>php folder and replace lines 262-266 with the following:

    $text = preg_replace('/b([a-zA-Z]+://[w_.-]+.[a-zA-Z]{2,6}[/w-~.?=&%#+$*!]*)b/i',"<a href="$1" target="_blank" class="twitter-link">$1</a>", $text);
    $text = preg_replace('/b(?<!://)(www.[w_.-]+.[a-zA-Z]{2,6}[/w-~.?=&%#+$*!]*)b/i',"<a href="http://$1" target="_blank" class="twitter-link">$1</a>", $text);
    $text = preg_replace("/b([a-zA-Z][a-zA-Z0-9_.-]*[a-zA-Z]*@[a-zA-Z][a-zA-Z0-9_.-]*[a-zA-Z]{2,6})b/i","<a href="mailto://$1" target="_blank" class="twitter-link">$1</a>", $text);
    $text = preg_replace("/#(w+)/", "<a class="twitter-link" href="http://search.twitter.com/search?q=\1" target="_blank">#\1</a>", $text);
    $text = preg_replace("/@(w+)/", "<a class="twitter-link" href="http://twitter.com/\1" target="_blank">@\1</a>", $text);

    #64368

    Excellent!

    Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Add target to links in Twitter widget ?’ is closed to new replies.