Support » Themes and Templates » Pagination for static page with post loop

  • Resolved zeaks


    I made a custom page template for Twenty Twelve. The pagination works fine unless I set it as a static homepage, then it will just reload the same posts which is useless because it will be used as a static homepage.

    This is what I’m using to display the pagination.

    <?php /* Display navigation */ ?>
    <?php if (  $wp_query->max_num_pages > 1 ) : ?>
    	<?php twentytwelve_content_nav( 'nav-below' ); ?>
    <?php endif;
     wp_reset_query(); ?>

    Any idea how to make it work for a static homepage as well?

Viewing 1 replies (of 1 total)
  • This is working now, I’ll post what I did in case anyone else needs it. Above the query in the page template I added

    global $paged, $wp_query, $wp;
    $args = wp_parse_args($wp->matched_query);
    if ( !empty ( $args['paged'] ) ) {
    	$wp_query->set('paged', $args['paged']);
    	$paged = $args['paged'];

Viewing 1 replies (of 1 total)
  • The topic ‘Pagination for static page with post loop’ is closed to new replies.