• Hi, I was wondering if anyone could help me.

    I’ve been trying to get a page on my site to display only posts from a single category. I have the code I’ve used to get the posts:

    <?php
        if ( get_query_var('paged') )
    	    $paged = get_query_var('paged');
    	elseif ( get_query_var('page') )
    	    $paged = get_query_var('page');
    	else
    		$paged = 1;
    		query_posts( array( 'category_name' => 'press' ) ); 
    
    ?>

    This code works fine for displaying the posts from the category ‘press’ as I wanted, but when I click on “older entries” to view more, it displays the exact same results. I know I have older ones than are displayed on the first page. It can be seen here:

    http://www.tekpakautomation.com/about-us/press/

    Thanks for any help

Viewing 1 replies (of 1 total)
  • You need to add the ‘paged’ argument to the query:

    query_posts( array( 'category_name' => 'press', 'paged' => $paged ) );
Viewing 1 replies (of 1 total)

The topic ‘Displaying posts from a single category’ is closed to new replies.