D
D
Denis2016-03-21 14:29:51
WordPress
Denis, 2016-03-21 14:29:51

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.
d046c16436944f88ae6a2c664e602a4a.png
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">&laquo; ' . __( 'Previous', 'i-max' ) . '</span>',
      'next_text' => '<span class="text">' . __( 'Next', 'i-max' ) . ' &raquo;</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">&larr;</span> %title', 'Previous post link', 'i-max' ) ); ?>
      <?php next_post_link( '%link', _x( '%title <span class="meta-nav">&rarr;</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

1 answer(s)
A
Andy-shak, 2016-03-22
@Andy-shak

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(' • ','&#171;Prev','Next&#187;'); ?>
<?php else: ?>
<?php endif; wp_reset_query(); ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question