Update: These code snippets are all nonfunctional thanks to Twitter’s 1.1 API update.
I get asked, literally some times every so often, the best way to integrate your latest tweet into WordPress. There are a few ways of doing this, but the way I’ve come up with is, I think, pretty nifty.
The first way is using Twitter’s profile widget creator, which displays tweets in a little box which you can change the colours and dimensions of. It’s actually not bad, but it’s a bit generic. It looks the same, despite colour differences, on everyone’s website, and it probably wouldn’t work with a site design similar to mine.
The next solution is using one of Twitter’s other widgets, which are hidden a little on the Twitter site (you need to go into Applications on the Twitter goodies page, not Widgets — it’s linked above for your convenience, though). You can choose between a Flash or HTML widget. The Flash version is similar to the previous widget, in that it looks pretty much the same everywhere, despite colour options. The HTML one is much, much better though. It allows for simple, easy CSS styling. I liked this method so much that I used it on the previous version of nickheer.com
However, I recently found a post on the Smashing Magazine site which described a method for displaying the latest tweet via PHP. This intrigued me, and I implemented it into this revision of the website, and immediately I ran into a huge problem.
This PHP method seems to get easily confused by symbols (<, > and & all seem to be problematic) and links. Bad news for me, since I seem to tweet links quite often. Note that this also applies to @replies, because the username is linked. After much trial-and-error, I think I’ve cracked the perfect way to show your latest tweet(s).
Update: e-sushi posted a much better version of this in the comments. Thanks for the new code.
The beauty of this code is that it replaces common symbols with their appropriate equivalents, and it parses links perfectly. The bulk of the code is from the Smashing Magazine article, but all of the string replacement code is by me. Please don’t forget to put your Twitter username on line 2.
I do not believe I have ever used this blog to communicate my love of espresso. My love of mochas, lattes, cappuccinos, correttos, Cubanos, ristrettos and affogatos. It is difficult to convey exactly why I adore these drinks so much, but I’ll try my very best.
It began when I was fourteen. I was in a little coffee house in the beautiful town that is Banff, and I was reading the list of all of the coffees one could have. It struck me that, obviously, these were not based on plain drip coffee, but rather based on a very strong coffee I’d heard of called “espresso” (or “expresso”, for those who are French, or incapable of comprehending the lack of an ‘x’). This ‘espresso’ coffee was right there on the board — for a mere two dollars, one could have a single ounce of pure, high-pressure extracted coffee. And for just a little more, one could have virtually unlimited permutations of milk, syrup and shot options. What a fantastic idea!
When I was sixteen, I fell in love with the cappuccino. I’d tried lattes, but found them a little weak — it was a higher proportion of liquid milk — and I wanted lots more of that wonderfully luxurious foam. I also became more selective (read: picky) about which coffee shops I frequented.
While many criticize on end about Starbucks’ questionable business practices, their trade ethics and their environmental impact, I can only be up in arms about their espresso, which is roasted until it has burned off all flavour leaving only ash. It’s sad, because the same ingredients in a mocha, for example, can yield a much better drink changing only to a better bean. And thus, with a better espresso machine at home (our Solis Crema had crapped out long ago), I began the search for my favourite kind of coffee. One I can drink day in, day out, and not have it grow tiresome. One which can be savoured with or without syrup, hot or cold, with milk, or just plain and unadulterated. The hunt was on.
Finding quality espresso in Calgary is something of a challenge. I stuck with the beans I’ve used for years, to start with. They’re a medium-dark from the local Italian market and while they weren’t bad, they were not the rich, full-mouth flavour I was seeking. Curiousity got the better of me as I struggled to find the perfect roast. Caffé Beano has excellent espresso, especially when mixed with milk, but I found it to be a little dark for straight drinking. I even struggled to find a perfect roast from the café I work at.
The best I found was when my dad and I went to France and Switzerland. As an aside, Swiss coffee is particularly good. They run a double espresso shot until it fills an 8-to-10 ounce mug, and it’s exquisite. It’s extremely rich, but not overwhelmingly so. French espresso (or expresso, if I were to use their spelling) is undeniably top trumps. Café Richard in Paris has a truly excellent blend called Richard Premium. I only brought back half a pound of it, and I’ve been kicking myself ever since. Sadly, there’s no way to order it online to be delivered to a Canadian address.
Currently, I have some Blends La Rosa Red in my grinder. It’s a blend of four beans, one of which is picked when it is bright red. It’s a medium roast with very little surface oil, and it’s extremely smooth. I like it, but it isn’t quite as good as the Richard Premium. I also have a pound of Be’ato Café Sorrento in an airtight container in my pantry, begging to be tasted. It’s a dark French roast, and I’m sure I’ll enjoy it.
I can only hope it’s as good as the Richard Premium.