Support » Plugin: WP-PageNavi » Now Working on static homepage

  • can you please help me on this? pagination is not working when i set the page in static homepage.
    here’s the code:

    <main id="main" class="site-main" role="main">
    					<?php
    					$paged = (get_query_var('paged'));
    					$wp_query = new WP_Query( array('post_type' => 'post', 'showposts' => '5', 'paged' => $paged) );
    
    					if( $wp_query->have_posts() ):
    					 
    						while ($wp_query->have_posts()) : 
    						
    							$wp_query->the_post();
    							get_template_part( 'moviecontent', get_post_format() );
    
    						endwhile;
    
    					endif;
    					wp_pagenavi(); ?>
    
    					<?php wp_reset_postdata();
    					?>
    
    				</main><!-- #main -->
Viewing 2 replies - 1 through 2 (of 2 total)
  • oh i mistype the title. it should be not working.:)

    when looking into core.php ob wp-pagenavi there are more arguments available for wp_pagenavi()

    
    
    	$args = wp_parse_args( $args, array(
    		'before' => '',
    		'after' => '',
    		'wrapper_tag' => 'div',
    		'wrapper_class' => 'wp-pagenavi',
    		'options' => array(),
    		'query' => $GLOBALS['wp_query'],
    		'type' => 'posts',
    		'echo' => true
    	) );

    so calling with ‘query’ should do it

    wp_pagenavi(array('query' => $wp_query));

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Now Working on static homepage’ is closed to new replies.