Support Forum
Hi,
I'm working with the MB views to create a template for the Event post type detail page, that I have created through Metabox post types.
On the event post type I have used custom fields for the date with datepicker option and time with timepicker option. Now while working with MB Views template, from the insert field if I do used the event date, For example like this -
{{ post.eventdate_options.event_starting_date | date( 'Y-m-d' ) }}
or event time field {{ post.event_time.event_start_time | date( 'Y-m-d' ) }}
then the frontend stops working and it gives me this error -
TypeError
twig_date_format_filter(): Argument #1 ($env) must be of type Twig\Environment, eLightUp\Twig\Environment given, called in /wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/Environment.php(358) : eval()'d code on line
So to resolve this here is what I have already tried-
1. Changing the date format.
2. Resetting the wordpress date format from general settings.
3. Selecting the timestamp and also the save format option from the date field options.
But none of the above help me.
Please help me to get this error resolved.
Thank you
Hi,
Can you please share the code that creates the custom fields on your site? Some screenshots would be highly appreciated.
Hi Long,
Here is the MB views code screenshot attached-
https://tinyurl.com/25r6ofhw
Here is the custom fields with their settings-
https://tinyurl.com/223drruo
Event post type
https://tinyurl.com/27ovpj5f
Thank you
Hi,
I got the issue. Please add a property timestamp
to format the date of a subfield date
in a group.
{{ post.eventdate_options.event_starting_date.timestamp | date( 'Y-m-d' ) }}
I will also inform the development team to fix this issue in the next update.
I have used the above provided code but still getting same error.
Please check it once again
twig_date_format_filter(): Argument #1 ($env) must be of type Twig\Environment, eLightUp\Twig\Environment given, called in /wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/Environment.php(358) : eval()'d code on line 58
Hi,
Can you please clear the cache, remove other Views and deactivate all plugins except Meta Box, MB extensions then re-check this issue? See how it works on my site https://monosnap.com/file/zmlMxh6AO5CVMMPGzf2hL1VIQVhUA0
I did the same as you suggested but still getting the same error,
Please check the screenshot attached.
Here are the steps we follow as suggested by you.
1. https://tinyurl.com/22tfnrr3
2. https://tinyurl.com/266o74hu
3. https://tinyurl.com/26nushac
4. https://tinyurl.com/247zaj9r
Please check it and let me know if any issue with the setting.
Thank you.
Hi,
Please share your site credentials via this contact form https://metabox.io/contact/
I will help you to investigate the issue.
Hi Support,
I have shared the website details through contact form.
Please check it and back to me.
Hi,
What I've done on your staging site:
- Deactivate all plugins except Meta Box, MB AIO, and switch to the standard theme of WordPress (Twenty TwentyTwo)
- Change the permalink settings to Post name (optional)
Then the date format displayed as well on the front page, see screenshots
https://monosnap.com/file/d9JHelC3jETCu1yI61k8Vn9oJeT59v
https://monosnap.com/file/6HVqTWlR3VLaHnZIxQFEmZwlT3bBEA
Can you please confirm it works?