The Guitar Blog: Reloaded
April 10th, 2007
I’ve been unsatisfied with how my Guitar Blog looks for quite some time now, and was reflected by my posting frequency in the last few months. That is, nil. It’s not a knock on the theme I was using before, the beautiful K2 Mod Unsleepable. Rather, it just wasn’t me, and I wanted something that was attuned to my aesthetics. And so, with that preamble out of the way, I present, the Guitar Blog Reload:

A couple of things stand out about this theme: first, the latest post is highlighted ala Squible, but the other posts are still displayed chronologically below it. Second, the latest post on the front page is paginated via CSS and javascript. This is how I did it:
<?php get_header(); ?>
// styling
<?php
$post_count = 1;
?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php if(is_home() && in_category(ASIDES_CAT)) continue; ?>
<?php
if($post_count == 1){
?>
// post styling
<?php
$post_count++;
}else{
?>
// asides styling
<?php
}
?>
Here, the variable $post_count is initially set to 1, and the loop checks that value for every iteration. At the end of the the first iteration, I add to $post_count’s value, so that when the loop checks it, it’ll apply the normal styles. That piece of code also shows how I’ve excluded my posts I’ve placed under the Asides category: via a previously defined constant (ASIDES_CAT). It’s that constant that I’ll use later on, via Coffee2Code’s Customizable Post Listings plugin.
The CSS pagination is handled by a slight modification to a script I found at Dynamic Drive, along with stripos() and substr() on the_content() to dynamically separate the paragraphs. This treatment is only applied when is_home() or is_archive() is true, so single pages are displayed normally.





April 10th, 2007 at 10:31 am
[…] quite some time now, and was reflected by my posting frequency in the last few months. Here’s a closer look at some of the niftier things I did with the new […]