【发布时间】:2016-07-06 18:15:52
【问题描述】:
我正在尝试让这个 wordpress 页面模板显示特定帖子的摘录。创建帖子后,我确定将链接插入到我想要的位置。我能够获取标题、缩略图、永久链接等……但无论出于何种原因,我都无法获得摘录。我试过了:
the_excerpt();
get_the_excerpt();
the_content('',FALSE);
get_the_content('', FALSE, '');
get_the_content('', TRUE);
除其他外。当我尝试get_the_content('', TRUE) 时,它会为我提供链接之后的所有内容,但我想要链接之前的内容。
有什么想法吗?
<?php
$query = 'cat=23&posts_per_page=1';
$queryObject = new WP_Query($query);
?>
<?php if($queryObject->have_posts()) : ?>
<div>
<?php while($queryObject->have_posts()) : $queryObject->the_post() ?>
<div>
<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
<br>
<?php the_post_thumbnail() ?>
<?php #the_excerpt(); ?>
<div>
<a href="<?php the_permalink(); ?>">Read More</a>
</div>
</div>
<?php endwhile ?>
</div>
<?php endif; wp_reset_query();
?>
【问题讨论】: