Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Can't get the paginate_links nav to update after first click Reply To: Can't get the paginate_links nav to update after first click

#167782
rpk
Participant

Ok i think i figured things out. The nav is working now, there is only one slight flaw left. The updated codesnippet looks like that:


$args = array(
    'post_type' => 'news',
    'posts_per_page' => '3',
    'paged' => get_query_var( 'paged' )
);  
$the_query = new WP_Query( $args );
$temp_query = $wp_query;
$wp_query = NULL;
$wp_query = $the_query;
$total_pages = $wp_query->max_num_pages;
if ( $total_pages > 1) {
    $the_paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $pagination = array(
        'base' => @add_query_arg('paged','%#%'),
        'format' => '?paged=%#%',
        'mid-size' => 1,
        'current' => $the_paged,
        'total' => $total_pages,
        'prev_next' => True,
        'prev_text' => __( '<< Previous' ),
        'next_text' => __( 'Next >>' )
    );
}

the only problem left is that the first page has also the paged snippet as slug. instead of news/ it is also news/?paged=1

is it possible that the first page has news/ and the rest news/?paged= ? Best regards Ralf