Is there any why to hook into wp_list_comments or something to add custom DIV with after every 5 comment in WordPress?
I know I can modify comment data or comment template but I need to get something that hook into whole comments template.
Is there any why to hook into wp_list_comments or something to add custom DIV with after every 5 comment in WordPress?
I know I can modify comment data or comment template but I need to get something that hook into whole comments template.
2
Answers
i had done similar things in my naturopath blog. You need to find the while-loop what is getting the comments from your db. you simply add a counter in it, like we learned in first lesson of php, and add an if-clause to the while-loop.
It’s not perfectly well written, but i think you should get, what i mean. Comments, as well as posts are taken by while loops in wordpress. When you add a counter and if-clause to the loop, you can hook into a specific number or put something in between.
Maybe you can do it with jQuery.
First, make your div in a place that renders with your comments. You can do this modifying the template or making a plugin just for this. It is not important where in your pages it is showing, because it will be moved. Giv it a class, eg. youradd
In a js file (you can use the same DIY plugin for this. Remember to load de js file) write something like this
where youradd is the class of the div you just created and li:nth-child(3n+3) is… every 3 li element