I try to use a date generic field inside a Cred and wants to use a custom date field as a placeholder.
Here is the code I'm using :
[php]
[cred_generic_field type='date' field='set-new-date' class="form-control" output="bootstrap"]
{
"required":0,
"persist":1,
"default":[wpv-post-date],
"validate_format":0
}
[/cred_generic_field]
</code
With this code, the cred field is not displayed. If I remoive the line "default":[wpv-post-date], then the field is displayed inside the form (but I don't have any placeholder).
Is there a way to display a placeholder inside a date cred generic field?
I've written up a custom shortcode that should allow you to convert the date to a timestamp
Add the following to your Toolset custom code settings at Toolset->Settings->Custom Code. Once you've done this please ensure that you've activated .
Just tested it and this is not working. In fact, the shortcode does not return anything. I placed this code in a post :
[wp_get_timestamp date='[wpv-post-date]'] - [wpv-post-date]
and what I got was : – 23 juillet 2020 (meaning the shortcode return was empty !
The function has been created thanks to the "parameter" section of Toolset.
The custom shrotcode works on my end.
Would you mind allowing me to have admin access to the website so that I can have a more detailed look at this for you ?
Please where applicable please provide me with a link to an example page where I can see the issue.
I've enabled the private fields for your next response.
Thanks,
Shane
Sorry, that's now OK. You can try again.
The name of the file that contains the function in the Toolset parameters is : date-en-strtotime
The shortcode is placed inside a post : aaa
Be careful as this site is in production !
Regards
Pat
That's working in a post but not in a Cred Form.
Can you have a look on the following form : Backoffice Modif ins enseignement
I have placed your shortcode but nothing is displayed?
The form is displayed in this page : hidden link
and you can see the form by clicking the "PAIEMENT" button in the top right of the page.
Regards
Pat
The problem now was that the date field couldn't handle the nested shortcode and the original reason why the date format had to change was because the strtotime() function couldn't convert the french date.
With these limitations I had to get creative and convert the french month to the english equivalent and then parse the date to a timestamp.