Answer the question
In order to leave comments, you need to log in
Pagination is not working on the main (static) wordpress page. How to fix?
Good day everyone. Pagination on the page does not work when I select its main (static) in the settings, it usually works on other pages.
Perhaps this is being treated somewhere here, but since I'm not strong in php, I won't give a fret.
function imax_paging_nav() {
global $wp_query;
// Don't print empty markup if there's only one page.
if ( $wp_query->max_num_pages < 2 )
return;
?>
<?php
$big = 999999999; // need an unlikely integer
$args = array(
'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages,
'type' => 'list',
'prev_text' => '<span class="text">« ' . __( 'Previous', 'i-max' ) . '</span>',
'next_text' => '<span class="text">' . __( 'Next', 'i-max' ) . ' »</span>',
'add_args' => false
);
?>
<nav class="navigation paging-navigation" role="navigation">
<h1 class="screen-reader-text"><?php _e( 'Posts navigation', 'i-max' ); ?></h1>
<div class="nav-links">
<div id="posts-nav" class="navigation">
<?php echo paginate_links( $args ); ?>
</div><!-- #posts-nav -->
</div><!-- .nav-links -->
</nav><!-- .navigation -->
<?php
}
endif;
if ( ! function_exists( 'imax_post_nav' ) ) :
/**
* Display navigation to next/previous post when applicable.
*
* @since i-max 1.0
*
* @return void
*/
function imax_post_nav() {
global $post;
// Don't print empty markup if there's nowhere to navigate.
$previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true );
$next = get_adjacent_post( false, '', false );
if ( ! $next && ! $previous )
return;
?>
<nav class="navigation post-navigation" role="navigation">
<h1 class="screen-reader-text"><?php _e( 'Post navigation', 'i-max' ); ?></h1>
<div class="nav-links">
<?php previous_post_link( '%link', _x( '<span class="meta-nav">←</span> %title', 'Previous post link', 'i-max' ) ); ?>
<?php next_post_link( '%link', _x( '%title <span class="meta-nav">→</span>', 'Next post link', 'i-max' ) ); ?>
</div><!-- .nav-links -->
</nav><!-- .navigation -->
<?php
}
endif;
Answer the question
In order to leave comments, you need to log in
Try updating the links or building a different query.
What is similar
<?php query_posts( array('cat'=>2, 'paged'=>get_query_var('paged'), 'posts_per_page'=>'5' ) ); ?>
<?php //query_posts('cat=2&posts_per_page=2'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php endwhile; ?>
<?php posts_nav_link(' • ','«Prev','Next»'); ?>
<?php else: ?>
<?php endif; wp_reset_query(); ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question