这里只是一个快速的,我创建了一个函数来限制特定后期类型的摘录长度(因为我只在淡入滑块中显示特定的帖子类型节目)使用以下函数:
function client_excerpt($length) {
global $post;
if ($post->post_type == 'testimonial')
return 20;
else
return 55;
}
add_filter('excerpt_length', 'client_excerpt');
现在,当我在循环中调用get_the_excerpt输出我的滑块的div时,它工作得很好。但是,我不希望“阅读更多...”链接仅出现在那些摘录中。我可以阻止他们在我的函数中显示那些特定的摘录吗?
答案 0 :(得分:4)
尝试使用excerpt_more filter:
function new_excerpt_more( $more ) {
global $post;
if ($post->post_type == 'testimonial'){
return '';
}
}
add_filter('excerpt_more', 'new_excerpt_more');