使用Wordpress'摘录"更多"链接?

Mat*_*rym 6 wordpress

Wordpress的文档建议在functions.php中添加以下内容以启用我想要做的事情:

function new_excerpt_more($post) {
    return '<a href="'. get_permalink($post->ID) . '">' . 'Read the Rest...' . '</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');
Run Code Online (Sandbox Code Playgroud)

根据:http://codex.wordpress.org/Function_Reference/the_excerpt

但是当我将它添加到functions.php中,并且我尝试使用它时,我看不到更多的链接.以下是我尝试使用它的方法:

the_excerpt(__('(more...)'));
Run Code Online (Sandbox Code Playgroud)

我也尝试过:

the_excerpt();
Run Code Online (Sandbox Code Playgroud)

更新:我尝试了以下内容,但它返回错误(如果没有参数),或者它不显示任何摘录或任何内容(如果参数):

function new_excerpt_more($excerpt) {
    $link = get_permalink();
    $title = the_title('','',false);
    $ahref = '<a href="'.$link.'" title="'.$title.'">more...</a>';
    return str_replace('[...]', $ahref, $excerpt);
}
add_filter('wp_trim_excerpt', 'new_excerpt_more');
Run Code Online (Sandbox Code Playgroud)

Mat*_*rym 12

function new_excerpt_more($output) {
    return $output . '<p><a href="'. get_permalink() . '">' . 'Read the Rest...' . '</a></p>';
}
add_filter('get_the_excerpt', 'new_excerpt_more');
Run Code Online (Sandbox Code Playgroud)

适用于:

<?php the_excerpt(); ?>
Run Code Online (Sandbox Code Playgroud)