Twitter integration without widgets?
-
Hey People,
I’m using WPRemix style on one of my sites (a sandbox right now) and am looking to integrate twitter into the site “Most Recent Tweets” without having to use a sidebar widget.
Does anyone know of a good Twitter plugin that will allow me to just paste some php code into my PAGE and have it display the most recent tweets?
Cheers,
M
-
I recall seeing a couple of hacks similar to what you’re looking for at http://www.wprecipes.com. Maybe you should check them out.
That site is down or spelled wrong cause all I got was french π
That’s strange – just went there and everything’s working…
Try this link…
http://www.smashingmagazine.com/2009/03/04/15-useful-twitter-plugins-and-hacks-for-wordpress/
May I ask why you don’t want to use a plugin? I’ve just tried to insert a Twitter hack in my sidebar, and the latest tweet showed up, but it refused to update. Instead I used the Twitter for WordPress plugin, and that worked like a charm.
Do let me know if you find a good working hack, as I also try to use as little as possible plugins.
Best of luck!
Aaaahhh… Figured out why the link to WP Recipes doesn’t work. It’s that damn . after com – try this:
Better yet, try this link:
http://www.wprecipes.com/how-to-display-your-latest-twitter-entry-on-your-wp-blog
Best of luck!
OK, here’s a home-made hack I’ve devised. Copy the following into your functions.php:
function LastTwitter() { $options = get_option('widget_Twidget'); $account = $options['account']; // Your Twitter account name $title = $options['title']; // Title in sidebar for widget $show = $options['show']; // # of Updates to show echo '<div id="twitter_div">' .$before_title.$title.$after_title; echo '<ul id="twitter_update_list"></ul></div> <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>'; echo '<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/'.$account.'.json?callback=twitterCallback2&count='.$show.'"></script>'; } function Twidget_control() { $options = array('account'=>'YourTwitterAccountName', 'title'=>'', 'show'=>'1'); }In the second last line, enter your Twitter account name, as well as the number of tweets to display.
In my sidebar, I did the following:
<div id="twitterstatus"> <div id="twitterlogo"> <a href="YourTwitterRSSFeedURI"><img src="<?php bloginfo('template_url'); ?>/images/social/twitterbanner.png" alt="Get our Twitter feed" border="0" title="Get our Twitter feed" /></a> </div> <h2>Latest Tweets</h2> <?php LastTwitter(); ?> </div><!--END: twitterstatus-->For some reason, the title in the function doesn’t show up in the sidebar, by I side-stepped that by adding my own title in the sidebar (the <h2>…</h2> part)
I used/hacked Sean Spalding’s Twitter Widget ( http://seanys.com/2007/10/12/twitter-wordpress-widget/ ) – hope nobody minds!
Let me know if it’s working for you!
Ignore EVERYTHING I wrote above! Here’s a VERY nice script, and it’s straight from Twitter. Just paste the code wherever you want to display your tweets, and make the styling changes you want. Alternatively, you can go to http://twitter.com/goodies/widgets to set up your own widget.
<script src="http://widgets.twimg.com/j/2/widget.js"></script> <script> new TWTR.Widget({ version: 2, type: 'profile', rpp: 4, interval: 6000, width: 240, height: 70, theme: { shell: { background: '#f59f0a', color: '#000000' }, tweets: { background: '#214a68', color: '#ffffff', links: '#ecfa25' } }, features: { scrollbar: true, loop: false, live: true, hashtags: true, timestamp: true, avatars: true, behavior: 'all' } }).render().setUser('YOUTTWITTERUSERNAME').start(); </script>It works perfect on my site!
Good grief! I just came here to ask about this.
Are you pasting this code into your site, or into a Text widget in your sidebar? I got the code from Twitter, but when I paste it into a text widget, the “script” tag gets stripped off and the JS displays as just text. Is this normal behavior?
I created a <div id=”twitterstatus”> in the sidebar.php and pasted it there. I don’t like widgets!
This means that you’ll have to edit your theme’s sidebar.php (or whichever page you want to display it on – I’ve included a special “Tweets” page on my site, and inserted the code inside the loop).
I believe there is a way to get this into your widgets, but I haven’t tried that.
Best of luck!
The topic ‘Twitter integration without widgets?’ is closed to new replies.