从wp_page_list中排除几个页面


Exclude several pages from wp_page_list

大家好。我有wordpress模板。php与列表自定义页面。我需要从我的清单2页排除。这可能吗?我会给出我知道的也许有人知道答案。我很乐意解决这个问题。谢谢!

WHAT I HAVE

   <?php /* Template Name: # photography all archive */  get_header('photography'); ?>
<div class="base-content">
   <div id="archive-thumbnails-listing" >
    <?php $pages = get_pages(array('child_of' => 379,403)); ?>
     <?php foreach ($pages as $page): ?>
        <div class="thumb12">
        <div class="thumb20"><a href="<?php the_permalink(); ?>">
            <?php echo get_the_post_thumbnail($page->ID, 'full'); ?></a></div>
    <div class="thumb19"><a href="<?php echo get_the_permalink($page->ID); ?>"><?php echo $page->post_title; ?></a></div>
        </div>
    <?php endforeach; ?>
     </div>
</div>

<?php
$args = array(
   'exclude' => array(403), // exclude posts 379 and 403,
);
$pages = get_pages( $args ); ?>
<?php get_footer(); ?>

有两种方法可以使用get_pages

排除页面

第一个是exclude,您可以提供post ID的数组或整数。

第二个是exclude_tree,您可以提供一个帖子的ID,它将排除该帖子的任何子帖子。

,

<?php
$args = array(
    'exclude' => array(379,403), // exclude posts 379 and 403,
    'exclude_tree' => 379 // exclude any child of post 379
);
$pages = get_pages( $args );

法典:https://codex.wordpress.org/Function_Reference/get_pages