[Resuelto] date custom field has value of 1970/1/1 when Importing from a csv file
This support ticket is created hace 4 años, 12 meses. 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.
Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.
I am trying to: Get the right values for corresponding custom fields (created with toolset) when importing from a csv file, the other fields are alright, title, author, content, featured img. I have tried importing more than 5 times, but the date is still 1970-1-1 for all post.
Link to a page where the issue can be seen: enlace oculto
I expected to see: The date field should be 2019-06-06
Yes, the format of the date in the csv is different from the format in the toolset field, January 1, 1970.
Can you please tell me what format of the date is accepted in the toolset field?
Hi Shane,
It's a frontend search.
I have attached a screenshot of what I want to achieve, it's under the "filter by timeframe" in the screenshot.
Thanks.
Hi, Shane is on holiday this week and I'd like to continue assisting you with this ticket. I tried logging in using the credentials you provided, but I get an invalid password error. Can you double-check the login and provide updated credentials if necessary? I have activated private fields again for your next reply.
Okay I'm not exactly sure what Shane had in mind, but I was able to create a custom select filter with multiple date options:
[wpv-control-postmeta field="wpcf-blog-date" type="select" url_param="wpv-wpcf-blog-date" source="custom" display_values="Any,Past 3 Years, Past 5 Years" values="-9999999,[tssupp-strtotime str='3 years ago 0:00:00'],[tssupp-strtotime str='5 years ago 0:00:00']"]
I updated the query filter to show results from dates "Any", "Since 3 years ago at 0:00:00", and "Since 5 years ago at 0:00:00". I had to disable the View setting "only show available options for each input" to make this custom filter work. You can see the results update in the View now, and the dates seem to be accurate. If you'd like to adjust those values, you can see how they are configured in the shortcode above. I created a custom shortcode that converts strings like "3 years ago at 0:00:00" into timestamps. I added that in Toolset > Settings > Custom Code, but you could move that into your child theme's functions.php file if you'd prefer to have it there. I also registered tssupp-strtotime in Toolset > Settings > Third party shortcode arguments so it can be used in the filter shortcode.
One strange thing I noticed is that the URL of the page is updated incorrectly after I submit a search. Is this something you have noticed before, or do you have any idea why this would be happening? If not, I need to do some more in-depth investigation here because the updated URLs are not correct. They point to the AJAX request URL, not the updated page URL.
Thank you for your help, I will read through the changes you have made and ask you if I have any questions.
Regarding the URL updating incorrectly after submitting a search, I have no idea why it is happening, but I when I seperate the search form and the result, there are 2 options to choose from "the search result will display in the same page as the search form" and "the search result will display on another page", and I selected the "same page" option, I don't know if there is any relation to this problem.
Los hilos nuevos creados por Christian Cox y vinculados a este se encuentran a continuación: