My Wordpress comment box is wrapped inside an accordion. Once checked, the comments appear below.
When you click "reply" under one of the comments, the page reloads and the accordion is collapsed again. It takes you to a blank space on the page, where the comment box would be if the accordion were still open.
Any way I can keep the accordion open or make the comment box appear below the specific post that needs replying?
The specific function that reloads the page is :
onclick='return addComment.moveForm( "div-comment-28", "28", "respond", "1409" )'
I'm using the default wordpress comment code, found in comments.php. Here is the html:
<div class="accordion check">
<label for="panel1" class="ac-label">View Comments</label>
<input id="panel1" type="checkbox"/>
<div class="panel">
<ol class="commentlist">
<?php
//Gather comments for a specific page/post
$comments = get_comments(array(
'post_id' => get_the_ID(),
'status' => 'approve'));
//Display the list of comments
wp_list_comments(array(
'per_page' => 10, //Allow comment pagination
'reverse_top_level' => false //Show the latest comments at the top
), $comments);?>
<div class="comments"><?php comment_form(); ?></div>
</ol>
</div></div>
Possible solution. If the reply to appears below the comment, the page will not reload and the accordion will not collapse.