我通过高级自定义字段插件添加了一个自定义字段。我正在尝试将字段的内容缩减到一个固定的字数。我曾尝试使用摘录过滤器并设置自定义长度,请参见下面的代码,但它不起作用,我想?
// set the length of the excerpt
function custom_excerpt_length( $length )
{
return 20;
}
add_filter( \'excerpt_length\', \'custom_excerpt_length\', 999 );
// apply the filter and strip crap from \'description\'
// http://codex.wordpress.org/Function_Reference/the_content
$content = apply_filters(\'the_excerpt\', get_field(\'description\'));
$content = str_replace(\']]>\', \']]>\', $content);
echo $content;
//echo wp_trim_excerpt($content);
我还尝试了wp\\u trim\\u except()函数,但它也没有任何作用。这篇文章的整个篇幅都在重复。