Hi!
I'm using WP All Import in combination with a cron job to import audio files from an XML file. This also imports a date, that is stored in a Toolset custom date field. But if I want to filter these audio files by date in a view, I get a 'no items found' message.
Is it possible the date field WP All Import creates can't be read by Toolset? If I open a single page in the backend the date field shows as normal.
hidden link
Hope you can help me fix this. 🙂
Hi,
Thanks for the details, I can login into your website and see the problem.
Here are what I found:
1) you are using filter in view
hidden link
Date uitzending is een string gelijk aan URL_PARAM(wpv-wpcf-date-uitzending)
Types custom date field stores value in timestamp format, so it should be:
Date uitzending is een nummer gelijk aan URL_PARAM(wpv-wpcf-date-uitzending)
See our document:
https://toolset.com/documentation/user-guides/date-filters/
But I have tried it, the problem still persists, so the problem is abnormal.
2) Please try these:
a) In case it is a compatibility problem, please deactivate other plugins, and switch to wordpress default theme 2019, and test again
b) If the problem still persists, please provide database dump file(ZIP file) of your website, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/
Thanks for the details, I am downloading the files, will update here if there is anything found
Here are what I found,
The problem is that you are using other plugin to import the custom date field "date-uitzending" value, it should be the timestamp value of 00:00:00 of specific date, but it seems you have imported some other timestamp values.
You can try these:
1) Edit the post view "Uitzendingen", in section "Loop item in Uitzendingen", display custom date field "date-uitzending" value in timestamp format, like this:
[types field='datum-uitzending' style='text' format='U'][/types]
Test it in front-end, for example:
in post "audio/2019/01/10/5c36eea50c0ef5c36eea50c12a.mp4", it output the value: 1547103964
but the accurate value for date 2019/01/10 00:00:00 should be: 1547078400
So it conducts the problem, they are not equal to each other, and Views outputs the result:
No items found
I suggest you import the data again, setup the date field value manually, you can get the timestamp value by using view, for example:
hidden link
There is a URL parameter "wpv-wpcf-date-uitzending", value "1547078400" is the timestamp of date 2019/01/10
Hi Luo,
Thanks for the solution.
I'm importing a XML file, with the date value {pubDate[1]}. The plugin says 'use any format supported by the php strtotime function'.
Do you have any idea how I can use this function to import it the right way?
Thanks,
Tim
You can try the PHP function strtotime, like this:
echo strtotime('2019/01/10');
It should be able to output the timestamp value like this:
1547078400
More help:
hidden link
Hi Luo,
Thanks, but I can't get this to work.
The date get's imported in a custom field made with Toolset, in a way that Toolset can read and show it. So I don't understand why I can't use the Toolset View filters to filter by date. Is there a fix for this?
There is a file imported every hour, so setting the date manually as you suggested isn't really an option.
Thanks,
Tim
Dear Tim,
Please check my answer above:
https://toolset.com/forums/topic/cant-filter-view-by-date-after-importing-with-wp-all-import/#post-1181362
It is expected result, custom date field "date-uitzending" value isn't accurate value for date 2019/01/10 00:00:00, so the date filter won't work, and the problem is in your importing tools.
You can use strtotime function to get today's 00:00:00 timestamp, like this:
strtotime('today');
this is same result as:
strtotime('2019/1/14');