Single Post Navigation Within Each Category

i had the same problem with one of my sites and i used this hack:
on your themes category.php (or if your doesn’t have one then archive.php )
before the loop part witch is something like this:

if ( have_posts() ) : while ( have_posts() ) : the_post();

add this code

if (is_category()){
     $category = $current_category = single_cat_title("", false); 
    if(isset(get_query_var( 'page' ))){
        $page = get_query_var( 'page' );
    }
    else{
        $page = 1;
    }
    global $wp_query;
    query_posts(
        array_merge(
            array( 'cat' => $category, 'paged' => $page ),
            $wp_query->query
        )
    );
}

this should loop only within the category.

Leave a Comment