Skip Navigation

[Résolu] Filter results with a ACF date and Views datepicker

This support ticket is created Il y a 6 années et 3 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par FrancoisJ6057 Il y a 6 années et 3 mois.

Auteur
Publications
#1096946
View  Programmes ACF   Formation Mauricie.png

Hi,

I've used ACF to create my custom fields (yes, I know I could use Types, but for many reasons, I use ACF).
The ting is when I want to do a custom search, I cannot filter the results.

Views show me the date in a WP format (j F Y in ma case, which is correct. Ex. 30 aout 2018 in french). ACF return me a dmy PHP format (ex. : 30082018). So when I try to limit/filter the results, it doesn't work.

I suppose I need to change the way the date is stored? Or do I only need to display it in the good format?
I actually use [wpv-post-field name="demarrage"] shortcode. Can I format it directly, or do I have to create a php function somewhere?

#1097352
Bildschirmfoto 2018-09-01 um 14.07.15.png

You can just change the Date Filter Query in the View to "Number" to make it work

In the Query Filter section of the View, the Date Filter is editable. There, pick the number option.

Since ACF will return a Timestamp the values will now be compared as numeric, so it should work.

#1099557

Thanks Beda, but doesn't seem to work either... I think I will use Toolset fields for the "dates" instead. It might be easier.