[Resuelto] Styling of fields from a dynamic source
This support ticket is created hace 4 años, 3 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.
Tell us what you are trying to do?
I want to style a date from a post field. I am do a Toolset loop over a Custom Post Type. In the Post type I have the date represented in two fields: 1) string (format: YYYY-MM-DD), 2) standard unix timestamp. I want the display on my page to look like "12. Oct".
When I am adding either of the two fields I dont see any date styling options in the editor (only font, color etc).
I am using Gutenberg editor.
I am not familiar with development.
any suggestions? Your support is highly appreciated!
When you are using the single field block to display your date field, there is field setting option that can allow you to setup your custom format. See Screenshot
In your case to get "12. Oct" you will use the custom format "j. M"
Unfortunately this isn't solving my problem. My date (given from another plugin) is either of string type or a standard unix time stamp. None of the two fields provide field settings shown in your screenshot.
Given that this is a custom field not from types then you won't get these options. You will need to create a shortcode to parse the date in the format that you want.
Doesn't the custom field plugin that you are using provide a way to retrieve the field value and format the date ? Which plugin are you using the create this custom field.
The custom fields come from a plugin called FooEvents. It is an add-on to WooCommerce (selling tickets for events). The two date fields are given by the plugin. And I dont know how to massage the date information with a shortcode into date format so it can be presented in the layout I want (I'm not familiar with wp development)
I hope you can advise a work-around for my problem
Can you try this field to retrieve the date field value and let me know exactly the value that you get from the database.
[wpv-post-field name='field-slug']
I've written a custom shortcode that helped a customer in the past with formatting their date information but I need to know what exactly is returned from the database. Replace field-slug with the correct slug of the custom date field.
Add this custom snippet to the Toolset custom code in Toolset -> Settings -> Custom Code and activate it. Once you've done this you can use the shortcode like this.