当我添加
<?php $excerpt = get_the_excerpt() ?>
到下面的单页 php 代码,我得到“解析错误:语法错误,第 10 行上的意外 T_STRING”
<?php get_header(); ?>
<div class="post"><?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php post_class('margin') ?> id="post-<?php the_ID(); ?>">
<div class="casestudy"><a class="anchor-hover">
<?php echo get_the_post_thumbnail( $post->ID ); ?>
<span class="details">
<p class="desc"><?php $excerpt = get_the_excerpt() ?>
</p>
</span>
</a>
<?php the_content(); ?>
</div>
<?php endwhile; endif; ?>
</div>
<?php get_footer(); ?>
我的functions.php文件原本没有
add_filter( 'get_the_excerpt', 'wp_trim_excerpt');
所以我补充说,但我仍然得到错误。我在这里想念什么?我把它从循环中取出了吗?