Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Simon Logan

Order/filter by custom field (date) column

I’m having issues similar to https://www.admincolumns.com/forums/topic/sorting-dates-is-not-working-for-me/ and have already tried the snippet here without success.

I have a custom post type created using JetEngine which includes two date fields (start and end date) which are stored as UNIX timestamps, however any time I try to filter by these fields (ie END DATE is IN THE FUTURE) I get only one single result even though there are many events with an end date in the future. I also try to sort by these fields and get them ordered in a manner which I just can’t figure out, it’s certainly not by date.

Is there anything I can do to fix this?

5 months, 2 weeks ago
Stefan van den Dungen Gronovius
Developer

Just to be sure, did you use the JetEngine column type or the ‘Custom Field’ column type?
I tried to reproduce the issue with the JetEngine column for that type (prefixed with the purple J icon) and it works out of the box.

And did you try the Smart Filtering (via add new filter button) feature or the default Filter feature (drop down on the page)

5 months, 2 weeks ago
Simon Logan

Double-checked and yeah we are using the JetEngine option rather than custom field, also using the Smart Filters. Feel free to check this screencast of the settings etc. https://capture.dropbox.com/uwHhQQOU8FzpDvmB

5 months, 2 weeks ago
Stefan van den Dungen Gronovius
Developer

Thanks for your message.
Can you make sure that the value in the database for that field is indeed a timestamp?
Might it be the case that you import or add the data for that field manually?
Or do you always manage the data from the edit post page in WordPress?

5 months, 2 weeks ago
Simon Logan

Hi Stefan

You know what, I think you could have nailed it – the data *was* imported using WPAllImport and the dates were formatted as mm/dd/yyyy, if I remember correctly. I guess I just presumed that, since the JetEngine field was configured as a timestamp, that the import would convert the values to timestamps upon import but that might not be the case.

Everything works fine on the frontend using JetEngine to display the content but it could just be that the way their plugins work accommodates that difference in dates.

In which case I presume what will be required will be for me to re-run the import to update existing posts but to convert the dates to timestamps in my Google Sheet first?

5 months, 2 weeks ago
Stefan van den Dungen Gronovius
Developer

That makes sense.
I don’t know if WPAllImport is advanced enough that it knows how to import JetEngine dates, but I suspect you need to prepare the data before you import the data.

Displaying and formatting the database value to a date is not the problem, our plugin can also do that.
But to sort and filter which is performed on the database, the actual date format does matter and needs to be consistent.

5 months, 2 weeks ago
Simon Logan

Understood and yeah I think what has happened is that we imported all the initial events using WPAllimport without adjusting the date format, then the client has manually added other events themselves, so there is now a mix of date formats stored in the db.

I’ll sort out an import to refresh those dates, thanks for your guidance.

5 months, 2 weeks ago

You must be logged in to reply to this topic.