This support ticket is created vor 1 Jahr, 7 Monate. 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I've removed the query filter and search field code for the "letzter Termin" field and added it again, with slightly different settings and it seems to be working now.
( screenshot: hidden link )
Here is the updated code for the search field, in the "Search and Pagination" section:
I'm afraid, for the date type custom fields, the select type search field filter is not supported. This is why you're seeing the raw, timestamp values when you change the field type to "select".
For the past date query filter, you only needed to change the type of the filtration to the 'number' in the view "Veranstaltungs-liste-date-archiv".
( screenshot: hidden link )
1. is there a jquery to reformat the timestamps to readable dates?
2. for the past date query filter - are you sure? - i did this on screenshot but it dont work - look at mine Screenshot. I also tried it with "string".
1. I was able to convert the timestamp values in the search fields, using some custom script, with the help of code from this guide: hidden link
You can see the code included and working in the view "Veranstaltungs-Liste-Filter01-archiv".
jQuery( document ).on( 'ready', function( event, data ) {
jQuery('select[name="wpv-wpcf-letzter-termin_min"] option, select[name="wpv-wpcf-letzter-termin_max"] option').each(function () {
var $this = jQuery(this);
if ($this.length) {
var selText = $this.text();
console.log(selText);
var conVerted = unixToDatetime(selText);
$this.text(conVerted);
}
});
});
function unixToDatetime(timestamp){
// Unixtimestamp
var unixtimestamp = timestamp;
// Months array
var months_arr = ['January','February','March','April','May','June','July','August','September','October','November','December'];
// Convert timestamp to milliseconds
var date = new Date(unixtimestamp*1000);
// Year
var year = date.getFullYear();
// Month
var month = months_arr[date.getMonth()];
// Day
var day = date.getDate();
// Hours
var hours = date.getHours();
// Minutes
var minutes = "0" + date.getMinutes();
// Seconds
var seconds = "0" + date.getSeconds();
// Display date time in F j Y format
var convdataTime = month+' '+day+' '+year;
return convdataTime;
}
Note: The custom code examples from our forum are shared to get you started in the right direction. You're welcome to adjust them as needed and for more personalized customization assistance, you can consider hiring a professional from our list of recommended contractors: https://toolset.com/contractors/
2. I couldn't find the page or the view that you referred to in your last message. Can you please share the link to the page where this view can be seen and the query filter is not working as expected?
The view "Veranstaltungs-liste-date-archiv" is set to show the "Termine" repeating field group posts, which are technically separate post types from the parent "Veranstaltungen" post type.
The custom field "letzter Termin" is not part of the repeating field group "Termine", which means that they are stored with the parent "Veranstaltungen" posts and not the "Termine" repeating field group posts.
This is why the query filter for this field is not working in this view. Only the custom fields which are directly part of the repeating field group "Termine" can be used for filtering this view.