Problems with pagination for a custom post type in wordpress

My pagination links are failing for a custom post type.

the page reloads root/cat/page/2/ but this has no effect on the displayed posts. Flushing the permalink structure has no effect so my guess is the problem is in the query.

$paged = (get_query_var('paged')) ? get_query_var('paged') : 10;
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query(array( 'post_type' => 'press',
                                'orderby'   => 'post_date',
                                'posts_per_page' => $paged,
while ($wp_query->have_posts()) : $wp_query->the_post(); 

    // The following determines what the post format is and shows the correct file accordingly
    $format = get_post_format();
    get_template_part( '/lib/includes/post-formats/'.$format );

    if($format == '')
    get_template_part( '/lib/includes/post-formats/standard' );


global $wp_query;

$big = 999999999; // need an unlikely integer

echo paginate_links( array(
    'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
    'format' => '?paged=%#%',
    'current' => max( 1, get_query_var('paged') ),
    'total' => $wp_query->max_num_pages
) );

$wp_query = null; $wp_query = $temp; ?> 


posts_per_page and showposts is essentially the same. These arguments define the amount of posts appearing on a page. showposts is deprecated and posts_per_page should be used instead. The relevant parameter for pagination is paged.

Hence the query arguments should look like this:

    'post_type' => 'press',
    'orderby'   => 'post_date',
    'posts_per_page' => 10,
    'paged' => $paged

For reference, see the codex on WP_Query, pagination parameters.

The answer turned out to be

'orderby'   => 'date',

rather than

'orderby'   => 'post_date',

Need Your Help

How to seperate the values of textbox so that I can sort by each value


I have a textbox where the user can input a value into a listbox. Then, I have buttons to either Delete that value, or Sort the value.

Stop forms from clearing on submit html forms

I'm using, but just using regular forms rather than runat="server" ones. Here is one:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.