I'm using the Imbalance theme and wonder if it might be possible to adapt the archive.php script to automatically check how many results will be returned and then direct straight to a post if there is just the one in this category.
I found this code elsewhere on the forum, but can't work out how it can be built in to Imbalance without causing major errors.
<?php if(have_posts()) : $category = get_the_category(); if ($category->category_count == 1) : while (have_posts()) : the_post(); wp_redirect(get_permalink($post->ID)); endwhile; else : include(TEMPLATEPATH . '/index.php'); endif; endif; ?>
Here's the Imbalance archive.php code:
I've tried placing the code in various parts but it just ends up with a blank screen. Any ideas? I'm stumped...