Chrondata Customization

I’ve had a few requests on the K2 forum to write up a tutorial on how I made my entry date information a.k.a. the “chrondata” display the way I have. I just put my son down for a nap so I have about two hours to work on this. OK, I’ve got my frozen burritos and Gobstoppers in front of me (they help me concentrate) so here goes. This tutorial is written for K2 beta two r167 which is no longer available for download.

For starters there are two places in your K2 install that you’ll make modifications: theloop.php and your stylesheet. Unfortunately you can’t accomplish this modification with your CSS alone, you’ll have to hack theloop.php as well. I’ll cover one step at a time.

hack theloop.php

  1. Go into theloop.php, if it’s not editable yet then you’ll have to set your permissions to either 755 or 777 on your server.
  2. Scroll down a little more than halfway. You’re looking for the /*Normal Entries*/ section. Now, you see that “chrondata” section? That whole <span class=“chrondata”> section? That entire span, you want to cut it and paste it right after the <h3> title tags.
  3. Now, that you’ve got your chrondata displaying to the right of your entry titles, you’ll want to change what information it displays as well as how it displays it.
    • Take out any references to the author. If you want to put this information elsewhere then you’ll have to figure that out on your own because I simply have no need for author information on my blog. That’s why I took that information out completely. I took this whole line code out: <Published <?php /* If there is more than one author, show author’s name / $count_users = $wpdb->get_var(“SELECT COUNT() FROM $wpdb->usermeta WHERE `meta_key` = ‘” . $table_prefix . “user_level’ AND `meta_value` > 1”); if ($count_users > 1) { ?> by <?php the_author_posts_link(); } ?>
    • Now, look for the part that says: the_time(‘F jS, Y’). This controls how your date information is displayed. Change it to: the_time(‘dMy’).
    • Keep in mind too, that this styling is not compatible with Dustin’s time since plugin.

OK, the hard part is over, let’s go style the bugger.

hack your stylesheet

  1. Now, this is where it gets really simple. Scroll through your stylesheet, looking for the .chrondata section. Found it? Great. Now style it however you want. Here is how I styled mine:

.chronodata {

padding: 0 0 0 2px;

color: #ccc !important;

font-family: Helvetica, Arial, Sans-Serif !important;

letter-spacing: -1px;

font-weight: bold;

font-size: 23px;

text-transform: lowercase;

}

Keep in mind though, I styled it this way to match my entry titles. You may desire to style it differently so it matches your style.

That’s all!

    The original idea for this particular styling was found on bensaunders.com. He’s not using K2 and I really have no idea what his code looks like. But that style has been used here with his full permission.

Pagan Christianity

One Comment

  1. - February 6, 2008

    [...] with my previous K2 tutorial, chrondata customization (I like alliteration), we’ll be doing some hacking in theloop.php as well as your stylesheet. [...]

Post a Comment

Your email is never published nor shared.

Archives

2008: 01  02  03  04  05  06  07  08
2007: 01  02  03  04  05  06  07  08  09  10  11  12
2006: 01  02  03  04  05  06  07  08  09  10  11  12
2005: 11  12