Support » Plugin: WP-PageNavi » Front page with wp_query, page2 has same content

  • Resolved hafman

    (@hafman)


    I’m using the code below

    <?php
    	$today = date('Ymd');
    	$start = get_field('start_date');
    	$end = get_field('end_date');
    	$end_today_y = date('Y');
    	$end_today_m = date('m');
    	$end_today_d = date('d');
    	$end_today = $end_today_y.''.$end_today_m.''.$end_today_d.'' - 1;
    	
    	//wp_reset_query();
    	//$paged1 = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
    
    	$args = array(
    	'category_name' => 'theatre',
    	'posts_per_page' => 8,
    	'paged' => get_query_var('paged'),
    	'meta_key' => 'end_date',
            'orderby'=> 'meta_value',
            'order' => 'ASC',
            'meta_query' => array(
    	    array( 'key' => 'end_date', 'compare' => '>', 'value' => $end_today ) ),
    	);
    
    	$home_query1 = new WP_Query($args);
    	if ($home_query1->have_posts()) : while ($home_query1->have_posts()) : $home_query1->the_post(); ?>
    		
    <li> <!--- contents --> </li>
    			
    <?php endwhile; else: ?>
    	
    <?php endif; ?>
    
    <div class="pagination"><?php wp_pagenavi(array( 'query' => $home_query1 )); ?></div>
    </ul>

    Very similar loop works fine on the category page. I’ve tested this with and without the second loop so i think it must be something to do with the wordpress static ‘Front page’. Any thoughts?

    PS this is the home page of a live site

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.