我一直在尝试在同一页面上显示精选帖子和最新帖子,但是当我使用分页时,它会在固定链接中显示/ page / 2,但它显示与第1页相同的帖子。我有一种感觉,查询是相互矛盾的!我该如何解决这个问题?代码
<?php query_posts( array(
'post_type' => array('event-', 'videos', 'videos-', 'audio', 'audio-'),
'posts_per_page' => 1,
'meta_key' => '_featured',
'meta_value' => 'yes'
));
?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="potdpostcon">
<div class="featuredimgpotd">
<a href="<?php the_permalink() ?>"><div class="featuredpostimgzoom"></div><?php the_post_thumbnail( 'featured-post-home' ); ?></a>
</div>
<div class="featuredbasepotd">
<div class="desclrgexcon"><span class="postexplrg"><a href="<?php the_permalink() ?>" class="postexplrg"><?php the_titlesmall('', '...', true, '82') ?></a></span></div>
<div class="goiconlargecon"><a href="<?php the_permalink() ?>" class="fade"><img src="/wp-content/uploads/2014/06/goicon_lrg.png" /></a>
<?php endwhile; endif; ?>
第二次wp查询:
<?php
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$args = array(
'post_type' => array( 'post', 'videos', 'videos-', 'audio-', 'event-'),
'showposts' => 80,
'paged' => $paged
);
$wp_query = new WP_Query( $args );
if ( have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post();?>
<?php
if( $current_date != get_the_date('d-m-Y') ){
echo '<div class="datetitle100spc"><div class="datetitleconspc"></div></div><div class="datetitle100"><div class="datetitlecon"><span class="dateheadertitle">'.get_the_date('l dS / M Y').'</span></div></div>';
$current_date = get_the_date('d-m-Y');
}
?>
<div class="postmainbase">
<div class="postexcon">
<div class="featuredimgexcon"><a href="<?php the_permalink() ?>"><div class="postcategoryex"><div class="postcategorytitle"><span class="catexsmall"><?php $category = get_the_category(); echo $category[0]->cat_name; ?></span></div></div><div class="featuredimgzoom"></div><?php the_post_thumbnail( 'home-posts' ); ?></a></div>
<div class="sepexcon"></div>
<div class="descexcon"><span class="postexp"><a href="<?php the_permalink() ?>" class="postexp"><?php the_titlesmall('', '...', true, '92') ?></a></span></div>
<div class="goexcon"><a href="<?php the_permalink() ?>" class="fade"><img src="/wp-content/uploads/2014/06/goicon.png" /></a></div>
</div>
</div>
<?php endwhile; ?>
<div class="paginationdiv">
<?php wp_pagenavi(); ?>
</div>
<?php endif; ?>