在我的存档页面上,\\u extract()不显示more标记之前的内容,而是文章完整内容的一部分。我必须在博文编辑器中完成“摘录”,这将覆盖它。如何强制\\u extract()只显示more标记之前的内容?
_excerpt()和<--more-->标记
2 个回复
SO网友:chrisguitarguy
为什么不干脆关掉the_excerpt
对于the_content
在你的主题中?或创建子主题并覆盖相关文件。
SO网友:wdalhaj
试试看Advanced Excepts 插件,工作正常或在函数中添加以下函数。php:
add_filter(\'the_excerpt\',\'my_excerpt\');
function my_excerpt(){
global $post;
$link=\'<a class="more" href=\'.get_permalink($post->ID ).\'>Read More...</a>\';
$excerpt=get_the_excerpt($post->ID);
echo $excerpt.$link;
return true;
}
前面的函数将帖子的perma链接附加到摘录,我们使用了过滤器the_excerpt
所以当我们使用the_excerpts();
这是我们定制摘录的结果。结束