Support » Themes and Templates » To go post from a category – Imbalance theme

  • Hi there,

    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.

    	if(have_posts()) :
    		$category = get_the_category();
    		if ($category[0]->category_count == 1) :
    			while (have_posts()) : the_post();
    		else :
    			include(TEMPLATEPATH . '/index.php');

    Here’s the Imbalance archive.php code:

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    I’ve tried placing the code in various parts but it just ends up with a blank screen. Any ideas? I’m stumped…

  • The topic ‘To go post from a category – Imbalance theme’ is closed to new replies.