Skip Navigation

[Gelöst] View for Comments

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

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 vor 3 Jahren, 1 Monat. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

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)

Dieses Thema enthält 5 Antworten, hat 3 Stimmen.

Zuletzt aktualisiert von aaronM-9 vor 3 Jahren, 1 Monat.

Assistiert von: Luo Yang.

Author
Artikel
#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

Sprachen: Englisch (English ) Spanisch (Español )

Zeitzone: 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

Sprachen: Englisch (English ) Spanisch (Español )

Zeitzone: 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: versteckter Link

#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!