【发布时间】:2014-11-16 07:28:13
【问题描述】:
我想使用 PHP 子字符串函数在 wordpress 中限制显示内容。我正在使用此代码
<?php $content = get_the_content();
echo substr($content, 50); ?>
但它不起作用。它显示完整的内容。
【问题讨论】:
-
substr 中的第一个参数是子字符串应该返回的位置。
-
我宁愿使用
the_excerpt(): codex.wordpress.org/Function_Reference/the_excerpt
标签: php wordpress substring substr