Skip Navigation

[Resolved] Show number of likes in view, sort by likes

This thread is resolved. Here is a description of the problem and solution.

Problem:
The customer asked how to sort the view's results by the number of likes.

Solution:
Guided to select the custom field that the likes plugin use in the view's order by settings.

Relevant Documentation:
https://likebtn.com/en/wordpress-like-button-plugin#sort_posts_by_likes

This support ticket is created 2 years, 11 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.

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/Karachi (GMT+05:00)

This topic contains 3 replies, has 3 voices.

Last updated by juttaB 2 years, 11 months ago.

Assisted by: Waqar.

Author
Posts
#2292229
Bildschirmfoto 2022-02-14 um 20.49.17.png

Tell us what you are trying to do?
I have created a view, which should show some post content and the number of likes and I am trying to sort the view by likes, unfortunately it does not work, as I have no clue how to name the like field. Do you have any idea how to find that out? I thought it would be "Like" as I can use this in the filter, but it dies not word.
I use the plugin likeBtn, but I can use whatever you suggest.

What is the link to your site?
hidden link

You should still have the login cress to the page - or is it safe to upload it here?

Regards and thanks

#2292545

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2022-02-15 at 07.56.26.png

Hi there

According to the plugin documentation it seems that the number of likes are stored in a custom field with the key "Likes", see hidden link.

So you should be able to set your View to order by this custom field: see the screenshot.

Note, however, that because this isn't a Types custom field, the field will only be offered in the ordering dropdown if a scan of the fields of a sample post finds an entry for that field. (The sample post would be the first post the View would load based on the existing ordering.)

So you need to make sure that the posts being queried by the View actually have some data for Likes, then you will find you can order by that field in the View settings.

#2292585

{ticket status updated}

#2299115

My issue is resolved now. Thank you!