Skip Navigation

[Resolved] Make double queries or SQL

This support ticket is created 5 years, 4 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 1 reply, has 2 voices.

Last updated by Luo Yang 5 years, 4 months ago.

Assisted by: Luo Yang.

Author
Posts
#1325805

Hi, Toolset..

We are working for display product using relevansi but we saw that it's not worked like what we need...

We want to sort a product with custom fields but look's like relevansi cannot sorted automatically..

So, it is possible to do 2 display on product list...means we run 2 queries for display product in page?

Or,

Is it possible to execute SQL code with Toolset? If can, how to make it?

Please reply ASAP... thanks...

#1325879

Hello,

There isn't such kind of built-in feature within Toolset plugins, Views plugin can not execute SQL code directly.

I assume we are talking about Woocommerce shop page, it is archive page of post type "Products", so you can use WordPress built-in action hook "pre_get_posts" to change the query settings, including orderby setting, see WordPress document:
https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts

See similar thread:
https://wordpress.stackexchange.com/questions/141355/wordpress-screwing-up-orderby-meta-value-num-in-pre-get-posts

But I am not sure if it is compatible with Relevansi plugin.