我想让这个wordpress页面模板显示特定帖子的摘录。当帖子创建时,我确定将链接插入到我想要的位置。我能够抓住标题,缩略图,固定链接等等,但是无论出于何种原因,我无法获得摘录。我曾尝试过:在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();
>
谢谢。这个工作除了给出了一个给定的字数的摘录。我希望用户能够通过该帖子的CMS手动在内容主体中包含“”链接,从该模板将显示一个摘录,该摘要在他们放置更多标签的位置结束。 – user2623706