Just found this site via the WP-Hackers List, been using WordPress for years (make a living partially thanks to it) and never stumbled on this site!
Posted this on the WP-Hackers list, but didn't find a solution.
I know WordPress 3.1 has removed the nofollow attribute from the comment Reply link (WordPress 3.1 beta looks good), but was working on something theme wise that should also work with removing the nofollow attribute from the link for WordPress 3.0.3 and below, but can't get it working.
from /wp-includes/comment-template.php
} else {
$link = "<a rel='nofollow' class='comment-reply-link' href='" . get_permalink($post->ID) . "#$respond_id' onclick='return addComment.moveForm(\"$add_below-$post->ID\", \"0\", \"$respond_id\", \"$post->ID\")'>$reply_text</a>";
}
return apply_filters('post_comments_link', $before . $link . $after, $post);
In WordPress 3.1 rel='nofollow' has been removed from the above code. I'm trying to achieve the same at theme level for WordPress 3.0.3 and below.
Basically adding this code to the comments loop as a test works:
$comment->comment_content = str_replace('nofollow', 'Test One',$comment->comment_content);
This removes the text nofollow from a comments body.
I tried
$comment_reply_link->reply_text = str_replace('Reply', 'Test Two',$comment_reply_link->reply_text );
As another test to replace the anchor text of the Reply link to confirm I'm on the right track.
Didn't work.
and
$comment_reply_link->link = str_replace('nofollow', '',$comment_reply_link->link );
to delete the nofollow part of the rel attribute.
Didn't work either
Tried a variety of permutations with no joy.
Any ideas?
David
Just found this site via the WP-Hackers List, been using WordPress for years (make a living partially thanks to it) and never stumbled on this site!
Posted this on the WP-Hackers list, but didn't find a solution.
I know WordPress 3.1 has removed the nofollow attribute from the comment Reply link (WordPress 3.1 beta looks good), but was working on something theme wise that should also work with removing the nofollow attribute from the link for WordPress 3.0.3 and below, but can't get it working.
from /wp-includes/comment-template.php
} else {
$link = "<a rel='nofollow' class='comment-reply-link' href='" . get_permalink($post->ID) . "#$respond_id' onclick='return addComment.moveForm(\"$add_below-$post->ID\", \"0\", \"$respond_id\", \"$post->ID\")'>$reply_text</a>";
}
return apply_filters('post_comments_link', $before . $link . $after, $post);
In WordPress 3.1 rel='nofollow' has been removed from the above code. I'm trying to achieve the same at theme level for WordPress 3.0.3 and below.
Basically adding this code to the comments loop as a test works:
$comment->comment_content = str_replace('nofollow', 'Test One',$comment->comment_content);
This removes the text nofollow from a comments body.
I tried
$comment_reply_link->reply_text = str_replace('Reply', 'Test Two',$comment_reply_link->reply_text );
As another test to replace the anchor text of the Reply link to confirm I'm on the right track.
Didn't work.
and
$comment_reply_link->link = str_replace('nofollow', '',$comment_reply_link->link );
to delete the nofollow part of the rel attribute.
Didn't work either
Tried a variety of permutations with no joy.
Any ideas?
David
Share Improve this question edited Dec 19, 2010 at 22:14 David Law asked Dec 19, 2010 at 22:08 David LawDavid Law 1431 silver badge7 bronze badges 2- The site is only several months old and still in beta. :) – Rarst Commented Dec 20, 2010 at 6:47
- Welcome to WordPress Answers David, have only recently joined myself... :) – t31os Commented Dec 20, 2010 at 8:41
1 Answer
Reset to default 5functions.php:
function remove_nofollow($link, $args, $comment, $post){
return str_replace("rel='nofollow'", "", $link);
}
add_filter('comment_reply_link', 'remove_nofollow', 420, 4);