在 wordpress 中为定义的 post 显示完整的 post(不是摘录)

Show full post (not excerpt) for defined posts in wordpress

我希望能够在 wordpress 中定义一些 post,其中显示完整的 post 而不是摘录。

有多种解决方案,例如:

第一个简单但丑陋,第二个应该可以用一些谷歌搜索但第三个似乎对我最有吸引力,但我不知道如何实现它。

因为通常在模板中,我所拥有的只是来自 wordpress 的某个 the_excerpt 方法。因此,我应该以某种方式在那里注入一些代码并检查是否设置了当前 post 的复选框,然后只使用 the_content 。这完全可能还是我需要修改主题?

感谢您的意见。

我会使用自定义字段,它更灵活,因此您不需要对页面 ID 进行硬编码。

<?php
$show_full_content = get_post_meta($post->ID, 'show_full_content', true);

if ($show_full_content == 'yes') {
    the_content();
} else {
    the_excerpt();
}
?>

您可能对 ACF 感兴趣,它可以使它更加人性化。