您应该为此使用自定义页面。作为参考,我们可以修改默认的(Twenty199POST)内容块。根据您的主题,您可能需要修改single.php
, 或其中包含的内容块。在twentynineteen
theme,我们可以在网上看到24
:
get_template_part( \'template-parts/content/content\', \'single\' );
接下来,我们可以研究
template-parts/content/content-single.php
at线
23
:
23 the_content(
24 sprintf(
25 wp_kses(
26 /* translators: %s: Name of current post. Only visible to screen readers */
27 __( \'Continue reading<span class="screen-reader-text"> "%s"</span>\', \'twentynineteen\' ),
28 array(
29 \'span\' => array(
30 \'class\' => array(),
31 ),
32 )
33 ),
34 get_the_title()
35 )
36 );
37
因此,您可以将此呼叫替换为
the_content
用这样的方式:
the_excerpt(); // Echo the excerpt directly.
$excerpt = get_the_excerpt(); // Store the excerpt in $excerpt.
// Retrieve the "raw" exceprt - this has not passed any filters etc,
// and instead comes directly from the database.
$post = get_post();
echo $post->post_excerpt;