Skip Navigation

[Closed] I Need Help for sorting options

This support ticket is created 2 years, 6 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/Hong_Kong (GMT+08:00)

This topic contains 8 replies, has 2 voices.

Last updated by Luo Yang 2 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#2546453
Catàlegs-–-DESDELSOFÀ-CAT.png

Hello Toolset team,

https://wordpress.org/plugins/yet-another-stars-rating/

I am using this plugin for a star rating. and the requirement to allow sorting by star rating as well.

I have to add sorting options for Alphabetically(Done), Latest post(Done), and Star Rating (I need help to get in hook[action/filter]).

I have checked your document guideline but have not found to exact hook for this.

this doesn't work directly toolset plugin so can you please share any hook or code tip to apply by filter or anything...

Here I have attached a screenshot of the shooting option and you can visit the developer's website for info hidden link

Thank you in advance

#2546975

any update please?

#2546977

Hello,

Do you have any document from "Yet Another Stars Rating" plugin about this:
- How do you store the rating value for each post in database?

If it is a custom post field, you can follow our document to setup the sorting control in post view:
https://toolset.com/course-lesson/creating-a-custom-search/#add-front-end-sorting-to-search-results
section "Add front-end sorting to search results"

If it is other custom database table, you will need to consider custom codes, for example:
Use wpv_filter_query filter to trigger a custom PHP function:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
In this PHP function, setupthe Order & Orderby Parameters of Views query:
https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters

#2547129
DESDELSOFÀ-CAT.png

Hi Luo Yang,

Thank you for your reply.

Do you have any document from "Yet Another Stars Rating" plugin about this:
- How do you store the rating value for each post in the database?
==> This is stored in a custom database table. let me know more detail.

My 2nd question is how I will add this custom short-order option add into the shortlist option. (Showing on the top of the list.)
See the attached screenshot. for this.

When selecting this option then apply this sort order to the post list.

Once again thank you.

#2548501
sorting-control.jpg

Q1) ==> This is stored in a custom database table. let me know more detail.

Toolset plugins are WordPress plugins, can only works with WordPress database tables.

Since "Yet Another Stars Rating" plugin stores rating value in other custom database tables, so you can not use it to sort the view's result by default, there isn't such kind of built-in feature to sort the result by other custom database tables.

You will need to consider custom codes, for example sync the rating value with a custom post field, then use that post field as orderby parameter.

Q2) For the new question:
how I will add this custom short-order option add into the shortlist option.

Please check answer of Q1), you can add new option into the sorting control block, see my screenshot

#2548735

Hi Luo,

Thank you for your reply. we will check and get back to you.

Thank You

#2549133

OK, I have marked this thread as "Waiting for feedback" status, please update here if you still need assistance for it. thanks

#2551387

Hi Luo,

I need some time for checking this custom filter option. So please wait for some time for on this.

Thank you

#2551471

OK, please update here if you still need assistance for it. thanks

The topic ‘[Closed] I Need Help for sorting options’ is closed to new replies.