我已经设置了一个查询,以查询每天80个帖子的日期,但它不会为我加载第2页。它总是说404错误。我真的不知道我哪里出错了。这是代码。
<div class="mainvideoscon">
<div class="videosallcenter">
<?php
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$args = array(
'post_type' => array('post','video', 'featured', 'spotlight'),
'paged' => $paged
);
$wp_query = new WP_Query($args);
if (have_posts()) : while ($wp_query->have_posts()) : $wp_query->the_post();
if ($current_date != get_the_date('d-m-Y')) {
echo '<div class="datetitlecon"><header class="datetitleh"><span class="datetitlehb"><i class="fa fa-clock-o"></i> ' . get_the_date('l ') . '</span>';
echo '' . get_the_date('dS M Y') . '</header></div>';
$current_date = get_the_date('d-m-Y');
}
?>
<div class="mvideocontv">
<a href="<?php the_permalink() ?>"><div class="mvideocontvfi">
<div class="gopostitem">
<?php
$posttype = get_post_type(get_the_ID());
if ($posttype == "post") {
echo '<img src="/wp-content/themes/justlooktv/images/gonews.png">';
}
if ($posttype == "video") {
echo '<img src="/wp-content/themes/justlooktv/images/play.png">';
}
if ($posttype == "spotlight") {
echo '<img src="/wp-content/themes/justlooktv/images/play.png">';
}
if ($posttype == "featured") {
echo '<img src="/wp-content/themes/justlooktv/images/play.png">';
}
?>
</div>
<div class="featuredimgblg"><?php the_post_thumbnail( 'ftimg-home' ); ?></div>
<?php if ('in_stock' == get_field('show_youtube_video')) { ?>
<img src="https://i.ytimg.com/vi/<?php the_field('youtube_video_id'); ?>/mqdefault.jpg" >
<?php } ?>
</div></a>
<div class="mvideodesccontv">
<div class="ppw"></div>
<a href="<?php the_permalink() ?>"><?php short_title('...', 58); ?></a>
</div>
</div>
<?php endwhile; ?>
</div>
<div class="paginationcon">
<div class="paginationfocus">
<?php wp_pagenavi(); ?>
</div>
</div>
<?php endif; ?>
<?php wp_reset_query(); ?>
感谢您的帮助
答案 0 :(得分:0)
尝试用此替换$ arg变量。
$args = array (
'post_type' => array('post','video', 'featured', 'spotlight'),,
'post_status' => 'publish',
'pagination' => true,
'posts_per_page' => '80',
);