If you have troubles since the update to WordPress 4.5 please read this post before opening a new thread.

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


    Using the Twitter widget as a shortcode on a page.

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



    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);




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

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