Support,
I'm trying to show the comments section for each post in a view with an accordion below each post title. I'm having trouble calling the posts to each accordion as the ID for the accordion is not changing.
I'm also having an issue that when each accordion is expanding, the post title gets drug don with the expanded height of the view content template.
Can you assist?
Thank you,
Charles
Hello Charles and thank you for contacting the Toolset support.
To better assist with this issue, I'll need to take a closer look at the view and how it is built. I also need to check how the comments are being added for each post, and how the accordion is implemented. Can you provide more details about the accordion? Is it provided by the theme or a plugin? Is it custom coded somewhere?
Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **
Hello Charles,
Sorry, there have been some changes since my last reply on your website that has broken the accordion further than how it was. I can't get to select any of the posts to inspect how it is.
Can you please revert the changes back to how it was, or let me try to build a new accordion for you, just let me know what should the accordions display, I assume that you want to display the following:
- Title area of the accordion: Should display the post title.
- Expandable area of the accordion: Should include the shortcode for comments. Or at least the content of the post.
Apologies. It's back to the way it was.
Thank you!
I can see different issues and I'll try to reply about each one below:
- Accordion: The accordions were not working because they all have the same ID attribute, so, we need to make the ID unique. We can use the post ID for that. I changed the content template code from:
<div class="CommentsBox">
<button data-toggle="collapse" data-target="#CommentBox">Comments</button>
<div id="CommentBox" class="collapse">
Below should come the comments:
[wpdiscuz_comments]
</div>
</div>
To:
<div class="CommentsBox">
<button data-toggle="collapse" data-target="#CommentBox-[wpv-post-id]">Comments</button>
<div id="CommentBox-[wpv-post-id]" class="collapse">
Below should come the comments:
[wpdiscuz_comments]
</div>
</div>
So, this is fixed, by you won't be able to see other accordions open because of the second issue. The commenting system does not render comments for each post, it only renders comments the first type. I added a text there to showcase that the accordion do open. hidden link
- Comments: The comments are generated by wpDiscuz, I tried to find out online how we can output comments for several posts on the same page, but I could not find anything. I suggest you reach out to the plugin's support and ask how to do it.
- Title flowing below when the accordion is open: This is caused by the title position, which is absolute. You will need to change it to relative and update the bottom value. Check this screenshot hidden link
I hope this helps. Let me know if you have any questions.
Ok. I believe I can eliminate the accordions and use styling from WPDiscuz to achieve my goal.
But it seems the bigger issue is pages not calling more than one comment box. Is there another plugin or would the inherit WP comments section achieve my goal?