Editing the Reply link code
-
Before I start, I would like to mention that I know just about nothing about PHP. I’ve been able to figure most things out with the help of these forums and Google, but I’ve now hit a wall with something.
I’ve set up my comment form to appear on the click of a link/button with Javascipt:
<a href="#respond" onclick="toggle_visibility('respond');">Show / Hide Comments</a> <script type="text/javascript"> function toggle_visibility(id) { var e = document.getElementById(id); if(e.style.display == 'block') e.style.display = 'none'; else e.style.display = 'block'; } </script>
In order to make the form visible when a user clicks to reply to an existing comment, I need to add the
onclick
event to the Reply link as well.I believe I found the place where I could do this in the core, but I obviously don’t want to edit the core files directly. This appears to be the relevant code starting line 1061 of comment-template.php:
$link = "<a class='comment-reply-link' href='" . esc_url( add_query_arg( 'replytocom', $comment->comment_ID ) ) . "#" . $respond_id . "' onclick='return addComment.moveForm(\"$add_below-$comment->comment_ID\", \"$comment->comment_ID\", \"$respond_id\", \"$post->ID\")'>$reply_text</a>"; return apply_filters('comment_reply_link', $before . $link . $after, $args, $comment, $post);
My question is: How do I add my onclick event to this code without editing the core file? Or if this not the correct code, then what is it and how do I go about doing it then?
Any help would be much appreciated.
- The topic ‘Editing the Reply link code’ is closed to new replies.