wp_trim_excerpt()为文章生成内容摘要

目录

描述

译文

必要时为文章生成内容摘要。

摘要应在55字以内,如果总字数多于该数目,摘要结尾应添加字符串'[...]'。如果少于55个字符,显示摘要全文。

原文

Generates an excerpt from the content, if needed. Must be used inside the "Loop".

The excerpt word amount will be 55 words and if the amount is greater than that, then the string ' [...]' will be appended to the excerpt. If the string is less than 55 words, then the content will be returned as is.

wp_trim_excerpt() 描述

用法

<?php wp_trim_excerpt$text ?>

wp_trim_excerpt() 用法

参数

$text

(string) (可选) The excerpt. If set to empty an excerpt is generated. If you supply text it will be returned untouched. It will not be shortened.

默认值: ""(empty string)

wp_trim_excerpt() 参数

返回值

(string) 

The excerpt.

wp_trim_excerpt() 返回值

注意

wp_trim_excerpt() 注意

历史

wp_trim_excerpt() 历史

源文件

wp_trim_excerpt() 函数的代码位于 wp-includes/formatting.php.

wp_trim_excerpt() 源文件

相关