我的循环中有一个条件是跳过多个记录以供显示。
例如wp_pagenavi
认为它是3页而不是2页。
我想在循环结束后更新页数。
<?php
$arg = array(
'meta_key' => 'closed',
'meta_value' => 1,
'post_type' => 'project',
'order' => 'DESC',
'orderby' => 'id',
'author' => $uid,
'posts_per_page' => $post_per_page,
'paged' => $query_vars['paged']
);
query_posts($arg);
if(have_posts()) :
while ( have_posts() ) : the_post();
if($myCondition)
continue; //skip record here
the_title();
endwhile;
if(function_exists('wp_pagenavi')):
wp_pagenavi(); endif;
endif;
感谢帮助。
我的状况:
$bids = "select * from ".$wpdb->prefix."project_bids where pid='".get_the_ID()."' and winner='1' order by id DESC";
$res = $wpdb->get_results($bids);
$selected_bid = $wpdb->get_results("select * from " . $wpdb->prefix . "project_escrow where `pid`={$res[0]->pid}");
$selected_bid = $selected_bid[0];
if(!is_null($selected_bid) )
continue;