Java on the Rocks

Blog

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.

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

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

Mmmmmmmm... cupcake

Blog

Seriously, no day is complete without a cupcake.

We went to the Bleu Cupcakery today (with my giggling, "Mer Bleu! Mer Bleu!" the whole way), and bought a half dozen. I fully expect to eat 5 of them to Mom's 1. We'll see.

The icing on this cupcake is stunningly light. Even Mom liked it.

Pages