此模板显示调用它的父页面的子页面。我需要修改它,使用slug或其他方法将父页面硬编码到特定的父页面。一旦我知道如何做,我想我可以让模板显示(在单独的div中)来自两个不同父母的子页面。有人能告诉我如何硬设置父页面吗?
谢谢
<?php
/*
Template Name: Portfolio Section
*/
get_header();
global $post;
?>
<h3><?php echo $post->post_title; ?></h3>
<div class="port_sec_container">
<?php
$items = get_pages( array(\'sort_order\' => \'ASC\', \'sort_column\' => \'menu_order\', \'child_of\' => $post->ID ) );
foreach( $items as $item ) : ?>
<div class="port_sec_item">
<a href="<?php echo get_permalink($item->ID); ?>">
<?php
$photosToShow = rand(1,3);
$images = get_posts( array( \'numberposts\' => $photosToShow, \'post_parent\' => $item->ID, \'post_mime_type\' => \'image\', \'post_type\' => \'attachment\' ) );
foreach( $images as $image ) {
echo wp_get_attachment_image( $image->ID, \'Portfolio-Thumb\' );
}
?>
</a>
<a href="<?php echo $item->guid; ?>"><h4><?php echo $item->post_title; ?> </h4></a>
<a href="<?php echo $item->guid; ?>"><h5><?php $fields = get_fields($item- >ID); echo $fields[\'location\']; ?></h5></a>
</div>
<?php endforeach; ?>
</div>
<script>
$(function() {
portSecInit();
});
</script>
<?php get_footer(); ?>