Twitter: Show Your Latest Entry On Your Blog

Want to show your latest entry to Twitter on your WordPress blog or website? It’s really very simple. Don’t be scared off by the vague instructions for adding a badge at the Twitter Badge page. The Twitter Badge page has some Flash badges at the very top and some javascript badges immediately below the Flash badges.

We’re mostly interested in the javascript badges. I don’t give two shits about Flash and refuse to add something to this site that will cause unnecessary lag just because it’s “pretty”. I’m a pretty devout follower of the K.I.S.S. philosophy. And besides, all we’re covering here is how to show your latest Twitter entry, pretty basic. Take a look below to see how I display “My Latest Twitter” in my sidebar.

1. Open your themes sidebar.php file (probably in /wp-content/themes/theme_name/).

2. Determine where you would like your Recent Twitter Status to appear in your sidebar.

3. Copy the following code and paste it into sidebar.php in the location you chose in step 2.

<div class="sb-lasttwitter">
<h2><a href="<em>yourTwitterUsername</em>/"><?php _e('My Latest Twitter'); ?></a></h2>
### insert javascript for Twitter Badge here ###

4. Open your themes style.css file and add a class called sb-lasttwitter. You can expand on the styling for the sb-lasttwitter class all you want. The CSS I use is below, it should work for most people as-is.

/*- most recent twitter*/
.sb-lasttwitter ul li {
	list-style-type: none;

5. After adding the sb-lasttwitter CSS class, save your style.css file and upload the newly modified file to your website.

6. Login to your Twitter account and click the “Badge” link at the top.

7. Click the first javascript badge, it should automatically select all of the code when you click on it. Copy the selected javascript code to your clipboard (right-click and copy).

8. After you’ve copied the badge javascript, go back to sidebar.php and find the line that reads: ### insert javascript for Twitter Badge here ###. Replace that line with the javascript you copied from step 7.

9. Save sidebar.php and upload it to your website, it goes in the same directory you uploaded style.css to.

10. Done! Visit your blog to (hopefully) see your latest twitter in the sidebar.

Once you’re done with that you should see “My Latest Twitter” in your sidebar. Immediately below that text you should see your most recent Twitter and how long ago it was entered.

You should also note that the code from step 2 may not work for every WordPress theme, in fact, it probably won’t. However, you should be able to make a few simple changes to make it fit perfectly with your blog’s theme. My point is, you may have to modify that code (and the CSS) to make this show properly with the rest of your blog theme.

Please be aware that the Twitter javascript badge breaks XHTML 1.0 Transitional validation. Fortunately, it’s an easy fix to get pages including the Twitter javascript badge to validate again. Remember, this is the javascript we copied in step 7.

Anyway, to make it pass XHTML 1.0 Transitional validation, have a look at the very last line of the javascript, towards the end of the line, should look similar to this:


Replace the text above with the following text:


Modifying the last line of the javascript as described above will make your site/blog pass XHTML 1.0 Transitional validation, assuming nothing else in your site is broken. WDG has some good information on why this change will help your site pass validation.

If you have any problems with this, please let me know! I will try to help people as much as I can, no promises though. If there’s enough interest, I may end up throwing together a very simple wordpress plugin to do all this automatically. It would seem the only Twitter WordPress plugins currently available require the WordPress Widgets plugin, which I don’t use. I just want a simple plugin to include the basic javascript badge without the need for Widgets. If nothing pops up within the next few weeks I’ll probably get to work on a plugin of my own.

There are two full featured Twitter WordPress plugins currently in development, both should be fantastic. The first plugin is Twitter Tools from Alex King. Twitter Tools aims to provide full integration between Twitter and WordPress. The second plugin in development is Twitt-Twoo from Dean J. Robinson. Twitt-Twoo isn’t aiming to be a full integration plugin like Twitter Tools. Twitt-Twoo is much more basic, although I believe it will allow you to post to twitter right from the sidebar of your blog, provided you’re logged in. I’m not sure if that functionality will be included in Twitter Tools as well or not.


WordPress Plugin: Digg This Reloaded

I’ve been using the Digg Integrator plugin for easy Digging of my posts. The Digg Integrator plugin has had it’s share of problems lately, mostly due to changes the folks at Digg have implemented. WildBil has managed to fix the plugin up quite nicely though, I haven’t been having any issues with the newest version.

If you’re having problems with the Digg Integrator plugin, you might wanna check out the Digg This Reloaded plugin. It’s got a bunch of nice features similar to features found in the Digg Integrator plugin. Looks like a very promising plugin, I am going to install it and give it a try sometime this week.


Send Your Tag Archives To Google Sitemaps

Do you use Ultimate Tag Warrior WordPress plugin to tag your posts? What about the Google Sitemaps plugin for sending google a copy of your sitemap?

If you use Ultimate Tag Warrior, as I do, you can get archive pages based off tags. For example, my wordpress tag page shows all posts tagged with “wordpress”. Simple enough.

Now, the Google Sitemaps plugin generates a sitemap of your site for submission to Google Sitemaps. The plugin will include categories, individual posts, static pages, and archives in the sitemap file it creates. However, it leaves out tag archives. This is simply due to the fact that the Google Sitemaps plugin author probably doesn’t use Ultimate Tag Warrior.

There’s some good information contained within tag archive pages, so we should probably be letting google know about them. We basically need to make the Google Sitemaps plugin recognize and make use of the tag archives. To do this, we need the Google Sitemaps – UltimateTagWarrior Tag Addon, a plugin for WordPress. Here’s the plugin description:

This plugin is a WordPress 2.0.4 plugin that automatically adds the UltimateTagWarrior tags onto the end of the google sitemap XML file as produced by the Google Sitemap plugin.

The plugin does exactly that, and nothing more. It simply generates a sitemap for your tag pages and appends that data to the end of the sitemap file created by the Google Sitemaps plugin. That’s all that’s required to include your tag pages in your sitemap file for sending to Google.

Please note that the Google Sitemaps – UltimateTagWarrior Tag Addon plugin requires version 2.0.4 of WordPress. Hopefully the author will update the plugin to support the upcoming WordPress 2.0.5.


Digg Integrator Plugin Fix

The Digg Integrator plugin v1.1 for WordPress hasn’t been working correctly. The author, WildBil, has been working on a fix for the last week or so. I got tired of waiting for a fix lastnight and took it upon myself to create one.

In addition to the referring Digg URL not being detected, I think there’s also a problem when submitting a site to Digg that has a “Preferred Digg Topic” set. The preferred topic is never sent along to Digg because the variable containing the preferred topic isn’t being called correctly in diggIntegrator.php.

All of the fixes I mention here are to be made within the wjt_diggThisPost function inside diggIntegrator.php. That function starts on line 225.

Now, moving on. The problem with the referring digg URL not being captured is extremely simple, I think. The function that captures the referring digg URL is simply not being called correctly. Basically, it’s not being run when it needs to. Look at line 278 in diggIntegrator.php:
Continue reading “Digg Integrator Plugin Fix”


Must-Have WordPress Plugins

First, I’ve got WP-Cache 2.0, my favorite of the bunch. I’ll just let the developer describe what WP-Cache does:

WP-Cache is an extremely efficient WordPress page caching system to make your site much faster and responsive. It works by caching Worpress pages and storing them in a static file for serving future requests directly from the file rather than loading and compiling the whole PHP code and then building the page from the database. WP-Cache allows to serve hundred of times more pages per second, and to reduce the response time from several tenths of seconds to less than a millisecond.

WP-Cache started from the “Staticize Reloaded” by matt and billzeller. Most of their recommendations also apply to WP-Cache. Current version, WP-Cache2, is a huge improvement over previous versions of WP-Cache.

It does exactly that, nothing more, nothing less. The administration interface is very nice, showing what pages are currently cached and the age of the cached page. It features a cache expiration setting, so a cached page will expire after a given number of seconds. Next time the expired page is hit, a new version will be cached. It also includes the ability to exclude certain pages from being cached. That way, when there’s any new content posted (new post or a comment), the new page content will be cached, so people never really see an out-of-date page.

Granted, there’s no noticible speed increase when loading some page, only due to the fact those pages serve so quickly without the cache. It does help with the main page, without a doubt. Before I started using WP-Cache, my database would do roughly 4 queries a second, on average. Now it’s never averaging more than 2 queries per second.

The second plugin is IPAT (Inline Pingbacks And Trackbacks), from Slobokan. I wrote about this one before, but it deserves to be included here too. At the time, IPAT was the only option as the inline trackback plugin from Kimberly Emerson was giving a 404 error when trying to download. Seems Kimberly lost the old code, but since then she’s written a new version which seems to be exactly like IPAT. IPAT was built on her original inline trackback code.

I’ll continue using IPAT simply because I’ve made a few adjustments to it for my own purposes, very minor adjustments at that.

The third and final WordPress plugin is “Post Moderation“. Although I’m not using this plugin, I have played around with it quite a bit. I really have no use for it as I’m the only author at this site (anyone wanna change that, let me know). The post moderation plugin allows multiple authors on your site and lets you maintain full editorial control. Isn’t that why so many people use MovableType instead of WordPress? Seems silly to buy a software package when there’s a WordPress plugin that accomplishes basically the same thing. Maybe MovableType has more desireable features than that, but I’ve seen many people say their reasons for staying with MovableType is to allow multiple authors. This plugin isn’t even required to have multiple authors in WordPress, it just allows you to keep editorial control over everything that’s published.

Might be something for you team bloggers to check out. Hopefully you’ll find one of the three plugins above somewhat useful. I know lots of WordPress people would enjoy inline trackback ability. Probably not so many people would get much use out of WP-Cache, but it sure speeds load times if you’ve got a lot of content on your main page, or any page for that matter.

Linked for attention at Outside The Beltway, NIF, Mudville Gazette, basil’s blog, Iowa Voice, and Common Folk using Common Sense.