Skip Navigation

[Resuelto] View for Comments

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem:

I noticed comments are not an option in Views. Is there a way to do this in Toolset?

Solution:

Toolset Views/Blocks plugins does not support WordPress Comments, see details here:

https://toolset.com/forums/topic/view-for-comments/#post-2189941

Relevant Documentation:

This support ticket is created hace 3 años, 1 mes. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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: Asia/Hong_Kong (GMT+08:00)

Este tema contiene 5 respuestas, tiene 3 mensajes.

Última actualización por aaronM-9 hace 3 años, 1 mes.

Asistido por: Luo Yang.

Autor
Mensajes
#2189177

I would like to make a view that allows me to filter out and display comments, but I noticed comments are not an option in Views. Is there a way to do this in Toolset? Specifically, I need it to pull out the comment that has the most likes on a given post (which is stored in a meta value). Thanks for any help you can offer.

- Aaron

#2189503

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

It is true that Views don't support the comment post type, not sure why but they never have.

You could try creating a View for some other post type, including a query filter for the custom field in question, and then use the wpv_filter_query API filter to modify the argument for the post_type to change it to comments.

I haven't tried it but I expect that it would probably work.

https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

#2189797

Thanks. Before I dig deeper, aren't comments stored separately (in the "comments" table instead of "posts"), so would it actually work to treat this as a post type for filtering purposes?

#2189941

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Doh. Of course you are right.

I was taking my cue from the question about using a View to display them and for a moment had it in mind that they were stored as posts with a type of comment, but they are indeed stored in their own table, sorry.

And that means a View cannot be used to display them, even legacy Views only supports posts, taxonomies, and users, there is no support for comments.

The official documentation for get_comments() is pretty sparse (https://developer.wordpress.org/reference/classes/wp_comment_query/get_comments/), you might try this guide which includes using meta query to filter comments by some custom field: enlace oculto

#2190385

Hello,

Toolset Views/Blocks plugins does not support WordPress Comments,
Please let me know if you still need assistance for it, thanks

#2190825

My issue is resolved now. Thank you!