I'm way way way excited to be speaking at dev.Objective in mid-May. Last year was an incredible experience. I expect this year's conference to be fantastic, too.

I'm going to be speaking about automating a number of the Front-End Site Performance things that you hear Paul Irish and Addy Osmani and all those other people say you should do. The advantage of automating the processes is that you don't need to remember to do them, AND you'll be able to see when something you changed adversely affects your site's performance.

The talk will end with a bunch of resources, and a completed setup that, in theory, you can drop into your current project and start automating right away.

Register Now for dev.Objective →

View on this morning's walk

Daily Photo

I am stupidly mad at the new gallery install I have going because it isn't rotating the image correctly. #grrrrr

MicroBlog

Java on the Rocks

Blog entry

Mom and I keep waking up at 3:00. "Yay West Coast time!" I guess. Since we're up, we might as well walk at dawn in the cooler air. Turns out, that Java on the Rocks, a breakfast place in Kona, is open at 6:00, so we had a destination for this morning. I suspect we'll be walking to a couple other places father down the street, since we've been at this one and we're making new memories on this trip.

The breakfast here was fantastic. Highly recommended for a morning jaunt.

tags: 

Today's visitor

Daily Photo

While sitting on the lanai, I had a visitor. He was a bit shy.

Adding Human Readable Content Type to Node display in Drupal 7

Blog entry

In the mismash of my site's content, I have a bunch of different content types on the front page, and it isn't clear what posts are what type. I've been reading a lot of books, so there are more book reviews than blog posts, and come on, who wants to read all of those reviews (hint: not me, I'm writing them so that I don't read the books again because I forgot that I read them the first time). So, on my vacation, I decided to get to the niggly little things that annoy me in various systems. First up: human readable content types in the posts.

I'm talking about these things:

Okay, so, to do this, in your theme's template.php file, add a node preprocess hook function. You may already have one. Look for THEMENAME_preprocess_node.

Add these two lines:

function THEMENAME_preprocess_node(&$vars) {
...
  $node_names = node_type_get_names();
  $vars['node_type_name'] = isset($node_names[$vars['node']->type]) ? $node_names[$vars['node']->type] : '';
...
}

This makes the variable $node_type_name available in the node template file. See node_types_get_names() for more details.

So, open the node.tpl.php file in your theme's template files. If you don't have one yet, copy it from modules/node/node.tpl.php into your theme directory and clear your theme registry cache.

In your node.tpl.php file, add these lines:

  <?php if ($node_type_name != '') { ?>
    <span class="title-type"><?php print $node_type_name; ?></span>
  <?php } ?>

I have it inside a if ($display_submitted): check, so it shows only when the submitted information displays. Your mileage may vary.

I styled the CSS using the .title-type class, cleared all caches, and done. Human readable content types displaying on nodes in Drupal 7

Pages