- September 14, 2018 at 4:46 pm #19195
I would like to know if it possible to have a custom field (date_from) in the result.
I have event and I would like to show the date of the event in the result.
here is the page…September 14, 2018 at 5:52 pm #19197
ok I find it.. but it’s a date in Timestamp; can i had something to transform it in DateSeptember 15, 2018 at 11:00 am #19201
To make that work, you will need a custom code to convert the timestamp to a visible date format. I have constructed a small snippet for you, which you can use in your theme functions.php file.
Try this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!
Change the following variables to your needs:
- $date_format -> This is parsed from wordpress, but you can use any date format string
- $field_name -> the custom field name
- $position -> use ‘before’ or ‘after’ depending if you want to display the date before or after the result content
- $prefix and $suffix -> to add text before and after the date field (including HTML)
I hope this helps!Best,
If you like my products, don't forget to rate them on codecanyon :)
You must be logged in to reply to this topic.