我使用的是WAMP,WordPress 4.3.1的干净安装(无插件)和入门主题-下划线。
我想要达到的目标是——我想写一篇只显示摘录的博文,所以我修改了内容。php和更改
<?php
the_content( sprintf(
/* translators: %s: Name of current post. */
wp_kses( __( \'Continue reading %s <span class="meta-nav">→</span>\', \'cthulhu\' ), array( \'span\' => array( \'class\' => array() ) ) ),
the_title( \'<span class="screen-reader-text">"\', \'"</span>\', false )
) );
?>
至<?php the_excerpt(); ?>
现在,我可以看到我的自定义摘录,但wordpress没有限制摘录的长度->我已经输入了100个单词进行摘录,而且内容似乎没有限制(默认情况下应该是55个单词)。我还尝试在函数中添加函数。php
function custom_excerpt_length( $length ) {
return 20;
}
add_filter( \'excerpt_length\', \'custom_excerpt_length\', 999 );
它不起作用。我也尝试过不同的主题——都是二十的版本——但仍然是一样的。
也许我只是太累了,但我一直在苦苦挣扎。。。