【发布时间】:2016-03-18 07:12:10
【问题描述】:
我想在锚标记中显示一些帖子内容并显示为链接,但我使用了wp_trim_words 函数我不知道如何允许 html 标记。
$more = ' <a href="'. get_permalink( get_the_ID() ) . '" class="readMoreBtn">Read More</a>';
$content = wp_trim_words( get_the_content(), 50, $more );
echo do_shortcode($content);
【问题讨论】:
-
但是通过 the_content 所有内容显示我想显示有限的内容。
-
我完全错过了
wp_trim_words()的标签剥离。更新了答案并对其进行了测试,现在@pia 应该可以工作了。