How to add a true/false option "Sort by custom field date"?

Home Forums Product Support Forums Ajax Search Pro for WordPress Support How to add a true/false option "Sort by custom field date"?

This topic contains 2 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 3 years, 5 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #21537
    tavy87
    tavy87
    Participant

    Hi there,

    I have a user custom field that stores a date like “2019-03-09”. All users have this date custom field. Is there a way to add a toggle to the search that will trigger results to be sorted by that date? Or is there a way to by default sort all user search results by that date (even without a frontend toggle)?

    Thanks for any help!

    #21538
    tavy87
    tavy87
    Participant

    I also know I can modify the user_registered field with my custom date data, and then use the sort by date feature in Ordering. The main issue with this is I don’t know how to have a frontend search field to toggle it on and off. (Also I don’t want to keep overwriting the user_registered field with my custom data). Any thoughts would be appreciated!

    #21555
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Well, I’m afraid that none of this is possible at this point, at least not without major modifications to the current code.

    I am working on a solution for front-end ordering filters, it should be available within the next two patches, although it depends a lot on the test results as wel. The custom field ordering you can set on the ordering panel only affects the post types. There will be additional two options there in the upcoming release to set a separate ordering for user results as well.
    I’m afraid there is no quick bypass solution/custom code for this, as the implementation for ordering by custom fields requires major changes to the main query as well as other files.

    The ordering by custom fields for user results will be definitely implemented in the upcoming release, front-end filter for ordering probably in the one after that.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.