Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用于post查询的编号wordpress PHP分页_Php_Wordpress - Fatal编程技术网

用于post查询的编号wordpress PHP分页

用于post查询的编号wordpress PHP分页,php,wordpress,Php,Wordpress,我有一个博客页面,显示了10篇文章,然后是带有“下一篇”和“上一篇”的导航。但是我们的客户需要一个编号的分页,而不仅仅是一个简单的页面导航 posts输出来自post查询,而不是标准的wordpress选项 <section class="blog"> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'posts_per_page' =>

我有一个博客页面,显示了10篇文章,然后是带有“下一篇”和“上一篇”的导航。但是我们的客户需要一个编号的分页,而不仅仅是一个简单的页面导航

posts输出来自post查询,而不是标准的wordpress选项

<section class="blog">

 <?php
 $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
 $args = array( 
 'posts_per_page' => 10, 
 'paged' => $paged, 
 'post_type' => 'post'
 );
 $cpt_query = new WP_Query($args);
?>

<?php if ($cpt_query->have_posts()) : while ($cpt_query->have_posts()) : $cpt_query->the_post(); ?>
 <div class="beitrag">
 <div class="beitrag-inhalt">


 <p><?php the_excerpt(); ?></p>
 </div>
      <div class="weiterlesen">
       <a href="<?php the_permalink(); ?>">Mehr Lesen</a>
      </div>
 </div>
 <?php endwhile; endif; ?>

<nav>
 <?php previous_posts_link( '<i class="fas fa-angle-left"></i> Vorherige Seite', $cpt_query->max_num_pages) ?>
 <?php next_posts_link( 'Nächste Seite <i class="fas fa-angle-right"></i>', $cpt_query->max_num_pages) ?>
</nav>

 </section>


引导示例
用户ID
名字
姓
城市名称
电子邮件
你有一个错误。仅适用于旧API。请考虑切换错误模式。