I have to load multiple posts on a single page. The situation is different. The client ask to reorder the posts, that the current post of the category becomes first and all the rest are next. Then on scroll I load the next posts (infinite scroll effect). So what I do is, I query the database, get the posts, find my current post in the returned collection, and create a new array with the already reordered posts and I load one post when the user reaches the end of the page, on scroll.
So far so good...
But my task is to show a corresponding comment form to each loaded post. So if I have 20 posts on my single page, I have 20 comment forms beneath each post. I can't find a way of doing this. The wordpress function comment_form(), comments_template(), they all render html and not return, which is the problem. I need to return the html of that form so I can insert it to my collection and render it along with the post on scroll.
Not sure what code I have to provide there, because I don't have any. If you need me to provide something, please ask.