WordPress 3.1 Finally Adds Long Awaited Admin Bar

I just got finished updating my blogs to WordPress 3.1, the latest release that’s been out for around two weeks now. The installation was painless and I have no real issues from themeforest wp themes to report yet. The first thing I noticed was the WordPress.com style admin bar which is a feature I think many will really like. Some won’t, but there’s a number of ways to turn it off. The easiest of which is to go into your personal profile options and just turn it off or you can change it display only in the admin section.

This release features a lightning fast redesigned linking workflow which makes it easy to link to your existing posts and pages, an admin bar so you’re never more than a click away from your most-used dashboard pages, a streamlined writing interface that hides many of the seldom-used panels by default to create a simpler and less intimidating writing experience for new bloggers (visit Screen Options in the top right to get old panels back), and a refreshed blue admin scheme available for selection under your personal options.

There’s a bucket of candy for developers as well, including our new Post Formats support which makes it easy for themes to create portable tumblelogs with different styling for different types of posts, new CMS capabilities like archive pages for custom content types, a new Network Admin, an overhaul of the import and export system, and the ability to perform advanced taxonomy and custom fields queries.

As I’m writing this post and getting it ready to publish I can tell there is a definite speed increase in editor interface which is good, it was starting to get bogged down. option panels I rarely use are all minimized and can be turned off via the screen option tab to clean up the editor interface even more.

Most of the other stuff I haven’t looked at yet, but I’m excited to play around with some of the new developer features and I can’t wait to see what the various frameworks can come up with now.

If you haven’t upgraded to WordPress 3.1 yet I certainly recommend you do. As always though, be sure to backup your database first, just in case.

Teaser Images For Thesis Theme

I absolutely love the Thesis Theme framework for WordPress. Sure there’s lots of really good frameworks out there now but Thesis, in my opinion, is one of the best. However, there’s one drawback and that’s being able to dynamically add a thumbnail to a teaser post. Most themes, as well as, frameworks insist on having you add a link to a thumbnail in one of the post meta fields. This is fine, it’s also foolproof , for the most part but it’s also a step that’s annoying as all heck to me.

If you search the web there’s lots of creative solutions out there, but none really did what I wanted. Below is a sample of how I wanted to layout the main page on my site Reality Wired.

Most of the time posts have an image and with the new the_post_thumbnail function in WordPress 3.x it’s fairly easy to get this. But what if your post doesn’t contain an image? Maybe it contains a Youtube video or a Flickr image what then? Well I came up with what I think is a fairly creative solution. Here’s the code.

/* Thumbs for teasers */ 
function thesis_teaser_wp_thumb() {  
	global $post, $posts;
	unset ($attachments);
	unset ($video_id);
	$default_thumb =  '<img width="100" height="100" src="'.THESIS_CUSTOM_FOLDER.'/images/noimage.gif">'; 

	$args = array( 'post_type' => 'attachment', 'numberposts' => 1, 'post_status' => null, 'post_parent' => $post->ID ); 
	$attachments = get_posts($args);

	// Check for a you tube video in the post and grab the video id
	preg_match('#https://[a-z]*?[\.]?youtube\.[a-z]*?/v/([\w-]*)#i', $post->post_content, $matches);
	if (!empty($matches[1])) { $video_id = $matches[1]; }

    if ( has_post_thumbnail() ) { 
    elseif (!has_post_thumbnail() && isset($video_id)) {
	if(@fopen("https://img.youtube.com/vi/$video_id/default.jpg",true)) { 
		echo '<img width="100" height="100" src="https://img.youtube.com/vi/'.$video_id.'/default.jpg">';
	} else { 
		echo $default_thumb; 
    elseif (!has_post_thumbnail() && !empty($attachments)) {
	foreach ( $attachments as $attachment ) { the_attachment_link( $attachment->ID , false ); }
    else {
	echo $default_thumb;

To use this function in Thesis you need to first add it to your custom_functions.php file inside your thesis_18/custom directory. Next you call this function via a hook. In the case of my blog I used the thesis_hook_before_teaser_headline hook location. Add this next line somewhere in the same custom_functions.php file. (I like to keep all my hooks at the top of the file but it can really go anywhere. Some prefer to place near the function itself, it doesn’t matter.)

add_action('thesis_hook_before_teaser_headline', 'thesis_teaser_wp_thumb', '1');  

Essentially we are telling WordPress that the hook should execute right before the teaser headline is processed and the third parameter, a 1 in this case, also tells WordPress to execute this function before any other hooks in this location.

Finally I’m adding a bit of css to my custom.css file (also located in the thesis_18/custom folder).

.custom .teaser {
border-top:2px dotted #BBBBBB;
.custom .teasers_box {
border-top:0 none;

.teaser img {float:left; padding-right:10px;}
a.teaser_link {float:right;clear:both;}
.format_teaser p {display:table;}
.teaser .format_teaser { margin-top:.5em; margin-bottom:.5em; }
.teaser .teaser_comments { float:right;}

Once you have this code in place it should alter your Thesis teasers to look like the sample I posted above. If you don’t like the layout just skip the css styling or customize your own. The guts you care about is the thesis_teaser_wp_thumb function. As is, the function should handle embedded Youtube videos (assuming you’re using regular embed code). So what if you want to use a different service? Well, I typically just use Youtube and it’s rather easy to get the thumbnail that Youtube generates when it encodes a video. That said, you should be able to modify this code to work with your chosen service.

// Check for a you tube video in the post and grab the video id
preg_match('#https://[a-z]*?[\.]?youtube\.[a-z]*?/v/([\w-]*)#i', $post->post_content, $matches);
if (!empty($matches[1])) { $video_id = $matches[1]; }

We use a preg_match to strip out the Youtube video id which we then insert into the code snippet below to call the thumbnail.

if(@fopen("https://img.youtube.com/vi/$video_id/default.jpg",true)) {
echo '<img src="https://img.youtube.com/vi/'.$video_id.'/default.jpg" alt="" width="100" height="100" />';
} else {
echo $default_thumb;

Here I check to see if the thumbnail I’m after exists and if it does I build the image code. If it doesn’t then my default thumbnail gets displayed.

I use the same process to grab thumbnails from Flickr and that code could be modified to fit other sources. At some point I turn this into a plugin but for now I thought I would share what I have. Feel free to use it, critique it or whatever.

Growing up without a cell phone

If you are 36, or older, you might think this is hilarious! When I was a kid, adults used to bore me to tears with their tedious diatribes about how hard things were when they were growing up; what with walking twenty-five miles to school every morning….Uphill… Barefoot…BOTH ways…yadda, yadda, yadda. I remember promising myself that when I grew up, there was no way in hell I was going to lay a bunch of crap like that on my kids about how hard I had it and how easy they’ve got it!

Well now that I’m over the ripe old age of forty and about to become the parent of a bonafide teenager, I can’t help but look around and notice the youth of today. You’ve got it so easy! I mean, compared to my childhood, you live in a freaking Utopia! I hate to say it, but kids today, you don’t know how good you’ve got it!

I mean, when I was a kid we didn’t have the Internet. If we wanted to know something, we had to go to the damn library and look it up ourselves, in the card catalog!!

There was no email!! We had to actually write somebody a letter – with a pen! Then you had to walk all the way across the street and put it in the mailbox, and it would take like a week to get there! Stamps were 10 cents!

Child Protective Services didn’t care if our parents beat us. As a matter of fact, the parents of all my friends also had permission to kick our ass! Nowhere was safe!

There were no MP3’s, Napsters, iTunes or torrents! If you wanted to steal music, you had to hitchhike to the record store and shoplift it yourself!

Or you had to wait around all day to tape it off the radio, and the DJ would usually talk over the beginning and @#*% it all up! There were no CD players! We had tape decks in our car. We’d play our favorite tape and “ejected” it when finished, and then the tape would come undone rendering it useless. Cause, hey, that’s how we rolled, Baby! Dig?

We didn’t have fancy crap like Call Waiting either! If you were on the phone and somebody else called, they got a busy signal, that’s it and then our parents would ground us from the phone, for like forever.

There weren’t any freaking cell phones either. If you left the house, you just didn’t make a damn call or receive one. You actually had to be out of touch with your “friends”. OH MY GOSH !!! Think of the horror… not being in touch with someone 24/7!!! And then there’s TEXTING. Yeah, right. Please! You kids have no idea how annoying you are.

We didn’t have fancy Caller ID either! When the phone rang, you had no idea who it was! It could be your school, your parents, your boss, your bookie, your drug dealer, the collection agent… you just didn’t know!!! You had to pick it up and take your chances, mister!

We didn’t have any fancy PlayStation or XBOX video games with high-resolution 3-D graphics! We had the Atari 2600 with games like ‘Space Invaders’ and ‘Asteroids’. Your screen guy was a little square! You actually had to use your imagination!!! And there were no multiple levels or screens, it was just one screen.. Forever! And you could never win. The game just kept getting harder and harder and faster and faster until you died! Just like LIFE!

You had to use a little book called a TV Guide to find out what was on! You were screwed when it came to channel surfing! You had to get off your ass and walk over to the TV to change the channel!!! NO REMOTES!!! Oh, no, what’s the world coming to?!?!

There was no Cartoon Network either! You could only get cartoons on Saturday Morning. Do you hear what I’m saying? We had to wait ALL WEEK for cartoons, you spoiled little rat-bastards!

We didn’t have microwaves. If we wanted to heat something up, we had to use the stove! Imagine that!

Our parents told us to stay outside and play… all day long. Oh, no, no electronics to soothe and comfort. And if you came back inside.. you were doing chores!

And car seats – oh, please! Mom threw you in the back seat and you hung on. If you were lucky, you got the “safety arm” across the chest at the last moment if she had to stop suddenly, and if your head hit the dashboard, well that was your fault for calling “shot gun” in the first place!

See! That’s exactly what I’m talking about! You kids today have got it too easy. You’re spoiled rotten! You guys wouldn’t have lasted five minutes back in 1970 or any time before!

The Over 40 Crowd

My Favorite Super Bowl Ad

There were a couple of other ads the were notable but for the most part this years Super Bowl ads were rather boring I thought. Mostly just knock offs from previous years with very little originality. I guess at $3M for a 30 second ad spot, that doesn’t leave much in the way of a development budget. The automakers however put the bail out money to good use, it seemed there was an automotive commercial ever break. My hands down favorite though was the Volkswagon commercial featuring Darth Vader and using the force. You just can’t go wrong with Vader in a commercial.

What was your favorite Super Bowl ad?

Scammers Ripping Off Mobile Customers Via Text Messages

Apparently the cellphone companies are all in cahoots with scammers to rip off their customers and the FCC is powerless to do anything about it. That’s right and it’s all nice and legal like. Have you ever gotten those unwanted text messages from some company offering you some service you don’t need or want? Yeah, we all have. Have you paid much attention to them or just ignored them like most telemarketing calls? I pretty much ignore them.

So here’s the scam. Whenever you get one of these text messages from some company like Flycell, offer anything from ringtone downloads to celebrity gossip or some other nonsense, if you’re like me you just ignore it. I mean logically, if it’s offering something and you don’t want it, ignoring it should be the same as saying “no I don’t want it” right? WRONG!!!! Somewhere in the message is usually a statement that says something to the effect “please reply if you DON’T want this service”. By ignoring the message, the company is assuming you DO want whatever it is they are promoting and charge it to your cellphone account. Which AT&T and most other service providers seem to allow with out any further confirmation.

Right now you’re going WTH!!! right? I know. After calling AT&T they removed the charges but said it wasn’t their system, it was the customers problem because that person (ie: me) didn’t respond to the text message. Is it just me or does that just seem bass ackwards? It means any Joe blow scammer can sign you up to any service via a mobile subscription and you’d never know it until the bill arrived. What a crock. They did say they could put a mobile purchase block on the line but that would also block purchases made from iTunes or the Apple App store which isn’t very reasonable if you’re an iPhone user.

This same type of thing happens on Facebook as well. Those wacky surveys that your friends are “supposedly” taking? Well pay attention to those if you’re playing around. NEVER give one of them your cellphone number or else. In many cases they ask for a cell number at the end of the survey which in most cases automatically subscribes you to some service.

……… and still wonder why I miss my StarTac from circa 1999 so much.

Disable WordPress Autosave

For some time now WordPress has had this rather annoying feature called Autosave that will save copies of each edit made to a post or page at some predetermined interval. I say annoying because I don’t use it and there are numerous plugins and posts dedicated to turning this feature off. None of which seem very effective. I suppose, if you’re some kind of hardcore editor the autosave function can be a life saver, or if you tend to write 1000 word posts then having an autosave function might be worth your while, but overall it just gets annoying, not to mention how badly it clutters up your database.

For whatever reason, the WordPress 3.x series still doesn’t feature an option to turn this off via wp-admin. Not sure why. At any rate, there is a very easy way to turn the autosave feature off. All you have to do is add the following line to your wp-config.php file.

define('WP_POST_REVISIONS', false );

Add it to the bottom of your config file and save. Simple as that.

Oh and if you don’t completely want to turn it off you can also specify how many times it saves. Simply add to your wp-config.php file:

define('WP_POST_REVISIONS', 3);

where the number 3 is the amount of times you wish autosave to save your post.

WPMU Block Spam By Math plugin updated for BuddyPress

A few people using this plugin have reported that it doesn’t work with BuddyPress. After some investigation it appears to be because BuddyPress has it’s own registration template and doesn’t use some of the standard hooks WPMU uses during the initial signup process.

Not a big deal however in order to make this plugin work with the default BuddyPress theme you will have to make 1 manual edit to a theme file. I couldn’t find any better way to get the necessary check into their workflow but it’s a pretty simple edit.

Jump to the main plugin page WPMU Block Spam By Math, use the download link to get the updated plugin (version 1.1) and scroll down to the instructions and follow the note for BuddyPress users.

Post any issues in the main plugin post.