我在wordpress中使用分页,事实上我已经使用过好几次了。但这一次,当我访问第2页时,我得到了一个错误404。我搜索了一点,尝试了几个功能,但没有成功。我在这里留下我的回路
<?php
$paged = (get_query_var(\'paged\')) ? get_query_var(\'paged\') : 1;
$news = array(
\'post_type\' => \'post\',
\'category_name\' => \'projekte\',
\'order\' => \'DESC\',
\'paged\' => $paged,
\'posts_per_page\' => 8
);
$wp_query = new WP_Query($news);
if (have_posts()) :
while (have_posts()) : the_post(); ?>
<div class="column is-one-quarter">
<a href="<?php the_permalink() ?>">
<div class="thecontent">
<div class="image-container">
<?php the_post_thumbnail(); ?>
</div>
<div class="post-container">
<div class="subtitle">
<?php the_title(); ?>
</div>
<div class="contain">
<p><?php the_field(\'beschreibung\'); ?></p>
</div>
</div>
</div>
</a>
</div>
<?php endwhile; ?>
<div class="pagination">
<?php
$big = 999999999; // need an unlikely integer
echo paginate_links(array(
\'base\' => str_replace($big, \'%#%\', esc_url(get_pagenum_link($big))),
\'format\' => \'/page/%#%\',
\'current\' => max(1, get_query_var(\'paged\')),
\'total\' => $wp_query->max_num_pages,
\'show_all\' => true,
\'end_size\' => 1,
\'mid_size\' => 2,
\'prev_next\' => true,
\'prev_text\' => __(\'\'),
\'next_text\' => __(\'\'),
\'type\' => \'plain\',
\'add_args\' => false,
\'add_fragment\' => \'\',
\'before_page_number\' => \'\',
\'after_page_number\' => \'\'
));
?>
</div>
<?php endif; ?>
<?php wp_reset_query(); ?>
我希望有人能帮助我,因为我有压力,我觉得自己受阻了。谢谢