Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Getting a twitter news ticker to work WordPress

  • SOLVED

Hi, I need some help trying to figure out how to get this on my site.

I want to have a twitter news ticker in the header, and I just don't understand how to make it work properly. I've used themes that have it built in (http://themeforest.net/item/fringe-tech-premium-wordpress-theme/full_screen_preview/234196 and http://themeforest.net/item/overall-premium-wordpress-blog-portfolio-theme/full_screen_preview/124861)

I can't seem to put something in on my own. I've uploaded an image of what i want the twitter to look like, and it would mimic the functionality of those sites above. Currently I'm trying something out (from http://www.tweetquote.co.uk) but I don't even know if it's capable of doing what those other sites have.

I just seem to be missing something. I also need to stick in a little twitter image (like on the other theme examples I gave) so I'm not sure what is the best solution.

Can someone help me find a solution and tell me how to install it so that it works smoothly as a twitter ticker?

My demo site is here: http://www.datilink.co.il

Thanks

Answers (2)

2011-09-11

Fahad Murtaza answers:

Hi

Where exactly in the header you want it?

(Glad you got it working in the last attempt. I myself learnt the jQuery loading twice mistake the hard way and in my case, I added a filter not to load it twice)

Regards,
Fahd Murtaza


Fahad Murtaza comments:

This might help

http://veronicawong.ca/2009/06/twitter-news-ticker-for-wordpress/

Has simple instructions to follow.


lifeblogs comments:

I tried her tutorial. :-) I'm not having much luck!


lifeblogs comments:

I want it right under the main menu. I attached an image showing what I'm trying to accomplish. Also, the links to the sites I gave in my question are exactly what I'm trying to get on my site.


Fahad Murtaza comments:

Got it. I am on it.


Fahad Murtaza comments:

Tried and couldn't get it to work. Hope others can help.


lifeblogs comments:

well, thanks for trying! it seems like it should be so easy.. i just can't put the pieces in the right places.


Fahad Murtaza comments:

I checked the TweetQuote and I couldn't get it to work with your HTML. Please check your HTMl for possible errors. One idea is to try the same TweetQuote script in a blank HTML page, see what happens.


lifeblogs comments:

Tweetquote was just the last thing that i tried, i'm not even sure about it's functionality. I was hoping someone would know of something easier to put in instead.


Fahad Murtaza comments:

Please try this plugin

[[LINK href="http://wordpress.org/extend/plugins/twitter-real-time-search-scrolling"]]http://wordpress.org/extend/plugins/twitter-real-time-search-scrolling[[/LINK]]

Instead of using its widget, just call this php code where you want to display it.


<?php
gTSRSSfeed_rss();
?>


Fahad Murtaza comments:

You will be able to achieve scrolling effect like your example site with the plugin.


lifeblogs comments:

trying now..


lifeblogs comments:

2 things -

1- the scrolling aspect works, but its reading search terms rather that going by user

2- i dont know how (or where) to set it to go by user, since all the settings are supposedly accessible when you drop it in as a widget in the sidebar.


Fahad Murtaza comments:

yeah I just read the code and that seems to be an issue. Unluckily the plugin developer hasn't cared for providing a usable PHP Api for it to be used. And I checked the the changes would need us to modify code for the plugin which is not a good idea.


Fahad Murtaza comments:

If [[LINK href="http://wordpress.org/extend/plugins/twitter-feed-scroller/"]]this one [[/LINK]] works for you, I can help you with its PHP call as this one is done nicely.


lifeblogs comments:

I came across it but was afraid to try it because of one of the comments 2 weeks ago "This plugin seems to break the feeds in the latest version of WordPress (creating an extra blank line above the beginning of the XML). Also received other php error when trying to use it." Also couldn't find a demo of it. Did you see it in action?

2011-09-11

Kannan C answers:

Place this function in your functions.php file

function get_twitter_updates($twitter_id, $tweet_count) {

$rssurl = "http://twitter.com/statuses/user_timeline/$twitter_id.xml";
$ch=curl_init($rssurl);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);

$rss = curl_exec($ch);
curl_close($ch);

if($rss)
{
$xml = @simplexml_load_string($rss);
if($xml !== false)
{
$i = 0;
echo "<ul>";
foreach($xml->status as $tweet)
{
// update id
$id=$tweet->id;
// update date
$created_at=$tweet->created_at;
// update text
$text=$tweet->text;
// update source ie: from web , from sharthis etc
$source=$tweet->source;
// update in replay to
$in_reply_to_screen_name=$tweet->in_reply_to_screen_name;
echo "<li>". stripslashes( $text ) ."</li>";
$i++;
if ($i == $tweet_count) break;
}
echo "</ul>";
} else
echo "Error: RSS file not valid!";
}
else
echo "Error:Username invalid or requires authentication";

}

and call the function from the header. This will only bring the tweets, you can then use your theme's news scroller there. If you want me to work in this as a freelance work, just pm me.


lifeblogs comments:

Ok, then I would like to know what you recommend. By a miracle, I got some sort of twitter ticker to work, but it causes the rest of the javascript based elements on my site to stop working.

Is your solution better? Or is there just a quick fix to get around this conflict?
Please take a look: http://datilink.co.il
You can see that the tabs are broken, the slider isn't working, there is no effect over the images.

What do you think is best to do? Is the problem just something small that I did?


Kannan C comments:

The problem is the jQuery library is loaded twice in your site. Try remove the loading jquery lib from the news ticker plugin.


lifeblogs comments:

Since I know very little about jquery, could you please explain what you mean by removing the loading jquery library?


Kannan C comments:

can you tell me what plugin you are using for your tweet scrolling?


lifeblogs comments:

I just went by the tutorial again:

http://veronicawong.ca/2009/06/twitter-news-ticker-for-wordpress

The instructions are to download the latest version of jquery, the latest version of newsticker.js, and also a plugin from wordpress called Twitter for Wordpress


Kannan C comments:

as per that tutorial you are loading the js files directly in your header file?
Ok then, look for

<script type="text/javascript" src="jquery-1.6.3.min.js"></script>

remove the above line from your header.php file as it is already from your theme file but a old version


lifeblogs comments:

YAAAAY!
Thank you, everything is working now.
Should i upgrade the jquery in the site? Or is it fine to leave it as-is?


Kannan C comments:

No need as long as everything is working fine. Please don't forget to vote the answers.