我试着让我的每一篇文章节选的链接都指向完整的文章“nofollow”,如下所示:
<a href="<?php the_permalink() ?>" rel="nofollow">→ Continue Reading</a>
然而,这似乎不起作用。我对WP/PHP非常陌生,那么我需要做什么呢?
最合适的回答,由SO网友:Johannes Pille 整理而成
在主题的函数中。php:
/* Returns a "Continue Reading" link for excerpts, with \'nofollow\' set */
function your_theme_continue_reading_link() {
return \' <a href="\'. get_permalink() . \'" rel="nofollow">\' .
\'<span class="meta-nav">→</span> Continue reading</a>\';
}
/* Replaces "[...]" (appended to automatically generated excerpts) */
function your_theme_auto_excerpt_more( $more ) {
return \' …\' . your_theme_continue_reading_link();
}
add_filter( \'excerpt_more\', \'your_theme_auto_excerpt_more\' );