php 从循环中排除子页面

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 从循环中排除子页面相关的知识,希望对你有一定的参考价值。

<?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>

//loop content

<?php endwhile; else: ?> <p>Sorry, there are no posts to display</p> <?php endif; ?>
<?php
      $args = array(
      'orderby' => 'title',
      'post_type' => 'cpt-name',
      'post_parent' => 0
       );
       $the_query = new WP_Query( $args );
?>

以上是关于php 从循环中排除子页面的主要内容,如果未能解决你的问题,请参考以下文章

php 从自定义循环中排除子页面

从 PHP 中的循环中排除(黑名单)多个 Json 条目

PHP 从类别归档中排除子类别

PHP 从WordPress中的循环中排除粘滞帖子

Woocommerce 如何从模板重定向挂钩中排除 myaccount 的子页面(端点)?

PHP 从Wordpress搜索结果中排除帖子或页面