Skip Navigation

[Resolved] Comments Accordion in Post Loop

This support ticket is created 3 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+00:00)

This topic contains 6 replies, has 2 voices.

Last updated by Jamal 3 years, 4 months ago.

Assisted by: Jamal.

Author
Posts
#1859673

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

#1859957

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

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. **

#1865875

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

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.

#1865977

Apologies. It's back to the way it was.

#1866227

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

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.

#1866471

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?

#1866955

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

I am not aware of any plugin that can offer this feature. But I think that you can build a custom shortcode that does it. Check the shortcode in this ticket https://toolset.com/forums/topic/display-comments-at-the-middle-of-a-content-template/#post-412863

And check this StackOverflow thread https://stackoverflow.com/questions/28593898/how-to-display-the-comments-template-with-a-shortcode-in-wordpress

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.