【发布时间】:2015-05-19 17:56:32
【问题描述】:
我正在尝试将多个页面显示为一个类别的帖子页面。
<?php
$mypages = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'post_date', 'sort_order' => 'desc' ) );
foreach( $mypages as $page ) {
$content = $page->post_content;
if ( ! $content ) // Check for empty page
continue;
$content = apply_filters( 'the_content', $content );
?>
<h2><a href="<?php echo get_page_link( $page->ID ); ?>"><?php echo $page->post_title; ?></a></h2>
<div class="entry">
<?php echo $content; ?>
<?php echo $page->post_title; ?>
<?php if(has_post_thumbnail()){ ?>
<?php the_post_thumbnail('featured');?>
<?php } ?>
</div>
<?php
}
?>
我有这个,但这段代码向我展示了每个页面的全部内容,我需要像帖子一样显示“阅读更多”链接和小内容。任何想法?谢谢
【问题讨论】:
-
查看
the_excerpt()的小内容和the_permalink()的阅读更多链接。