Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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' );
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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