1

I tried to make each one of my post excerpt's link to the full post "nofollow" like this:

<a href="<?php the_permalink() ?>" rel="nofollow">&rarr; Continue Reading</a>

However, that doesn't seem to work. I'm pretty new to WP / PHP, so what do I need to do?

2

In your theme's functions.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">&rarr;</span> Continue reading</a>';
}
/* Replaces "[...]" (appended to automatically generated excerpts) */
function your_theme_auto_excerpt_more( $more ) {
    return ' &hellip;' . your_theme_continue_reading_link();
}
add_filter( 'excerpt_more', 'your_theme_auto_excerpt_more' );
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.