WordPress.org

Ready to get started?Download WordPress

Forums

oAuth Twitter Feed for Developers
Converting hyperlinks and twitter users in twitter text (4 posts)

  1. jammy to go
    Member
    Posted 1 year ago #

    Hi,

    Are there any built in functions that make the urls and twitters hyperlinked that appear in the twitter messages ($tweet['text'])?

    P.S. Nice little plugin and easy to implement.

    http://wordpress.org/extend/plugins/oauth-twitter-feed-for-developers/

  2. msephton
    Member
    Posted 1 year ago #

    I think the plugin should use the official WordPress method of adding links to tweet text.
    https://github.com/mzsanford/twitter-text-php

    But a quick, though less comprehensive solution, would be to use this code:

    foreach($tweets as $tweet) {
      $tweet_text = $tweet["text"];
      $tweet_text = preg_replace('/http:\/\/([a-z0-9_\.\-\+\&\!\#\~\/\,]+)/i', '<a href="http://$1" target="_blank">http://$1</a>', $tweet_text); //replace links
      $tweet_text = preg_replace('/@([a-z0-9_]+)/i', '<a href="http://twitter.com/$1" target="_blank">@$1</a>', $tweet_text); //replace users
      echo $tweet_text;
    }
  3. jammy to go
    Member
    Posted 1 year ago #

    Cool!

  4. Liam Gladdy
    Member
    Plugin Contributor

    Posted 11 months ago #

    We're going to add this in the next release too :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.