从此线程:the_excerpt and shortcodes 我从@Programmer Dan那里提取了这段代码,它可以很好地将执行的短代码包含在自动生成的摘录中
add_filter(\'the_excerpt\', \'do_shortcode\');
remove_filter(\'get_the_excerpt\', \'wp_trim_excerpt\', 10);
add_filter(\'get_the_excerpt\', \'my_custom_wp_trim_excerpt\', 99, 1);
function my_custom_wp_trim_excerpt($text) {
if(\'\'==$text) {
$text= preg_replace(\'/\\s/\', \' \', wp_strip_all_tags(get_the_content(\'\')));
$text= explode(\' \', $text, 56);
array_pop($text);
$text= implode(\' \', $text);
}
return $text;
}
我的问题是,我不知道如何添加按钮或文本链接,以便阅读更多返回到原始文章的内容。