Skip Navigation

[Resolved] Parametric search custom ordering results

This support ticket is created 6 years, 10 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 4 replies, has 2 voices.

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

Assisted by: Luo Yang.

Author
Posts
#603539

I am trying to:
I am displaying posts ordered by a custom date field, but when I filter by taxonomy(urgency level), the results are ordered by post publish date. Is there a way to change the ordering on my results there?

Link to a page where the issue can be seen:
hidden link
user: demo
password: minnow

#603656

Dear Kristin,

It is possible to sort the posts by custom date field, Views also enables you to easily allow visitors to sort the front-end results, produced by the Loop Output:
https://toolset.com/documentation/user-guides/allowing-visitors-to-sort-the-front-end-results/

But I checked the URL you mentioned above:
hidden link
When I choose any option in select dropdown "HEALTH ALERT URGENCY LEVELS", it does not update the view's result, but get a JS error:
POST hidden link 500 (Internal Server Error)

That means there is PHP error occur in your website, I suggest you try these:
1) deactivate other plugins and switch to wordpress default theme, and test again
2) Enable PHP debug mode, copy and paste the debug logs here
PHP Debugging
In case you think that Types or Views are doing something wrong (what we call a bug), you should enable PHP error logging. Again, edit your wp-config.php file and add the following:

ini_set('log_errors',TRUE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
This will produce a file called ‘error_log.txt’ in your WordPress root directory. Make sure that the web server can create and write this file. If it cannot, use an FTP program to create the file and make it writable to Apache (normally, user www-data).
https://toolset.com/documentation/user-guides/debugging-types-and-views/

#603885

Hi Luo,

I fixed the 505 error, so sorting now works as expected.

I'm reading through the documentation, and am I gleaning that I would need to setup a dropdown filter for the custom date in order to filter that in the AJAX parametric search? Is there no way to set the default order of results to order by custom date? I have a sortable column setup for the custom date, so it feels redundant to also include a filter dropdown for that same parameter.

#604169

As I mentioned above, you can sort the view by the custom date field, please check these:
1) edit the view, click "Screen Options", enable option "Ordering", in section "Ordering", Order by your custom date field.

2) When you insert the view shortcode [wpv-view], make sure there isn't orderby attribute, for example:
[wpv-view name="test-2" orderby="date"]
It will override the Views settings.

3) in case there is any compatibility problem, please deactivate other plugins and switch to wordpress default theme, and test again

4) If the problem still persists, please provide a database dump file (ZIP file) of your website in below private detail box, I need to test and debug it in my localhost, thanks

#604598
order2.JPG
order1.JPG

Thanks for the details, I tried your database in my localhost (Fresh wordpress installation + the latest version of Toolset plugins + 2017 theme), I assume we are talking about the view "Health Alerts", you are using option: Order by "Field - Health Alert Date" "Desending"

And I tested it in the front-end:
hidden link
see screenshot: order1.JPG

field "Health Alert Urgency Levels" choose option "Advisory",
see screenshot: order2.JPG
Both cases works fine, it does order by the "Health Alert Date"

So it should compatibility problem of your website, please make sure these:
1) you are using the latest version of Toolset plugins
2) deactivate other plugins and switch to wordpress default theme, and test again

If the problem persists, please provide a test site with the same problem, and fill below private detail box with login details and FTP access, I need to test and debug it in a live website. thanks