好的,这可能是重复的,我只是无法将我的想法放入适当的搜索词中,对此表示抱歉!
是否有内置函数或模板标记来获取第一个n
内容的文字?我是说the_content()
.
谢谢
好的,这可能是重复的,我只是无法将我的想法放入适当的搜索词中,对此表示抱歉!
是否有内置函数或模板标记来获取第一个n
内容的文字?我是说the_content()
.
谢谢
是的,wp_trim_words()
:
<?php $trimmed = wp_trim_words( $text, $num_words = 55, $more = null ); ?>
或者在您的情况下:<?php echo apply_filters( \'the_content\', wp_trim_words( strip_tags( $post->post_content ), 55 ) ); ?>
您好,我正在使用自定义帖子类型UI和高级自定义字段插件,并希望使用默认内容编辑器作为自定义帖子类型的一个字段。当我使用_content()时;在输出内容的模板代码中,它不起作用。 <div class=\"singleProjectContainer\"> <h1><?php the_title(); ?></h1> <p><?php the_field(\'description\'); ?>