I have integrated a calendar into the meta view.
I have added the required div id into the template section that will display the calendar view using js library.
Here you can see we are using static data array that we need to convert with event post type data array.
I have added a query post argument into the meta view and get all the event title there.
Please let me know how can we add the array variable in which I can store the required data, encode it in json format and pass it into the script section.
Please check the attached screenshot and suggest me on it.
It is a basic question about creating an array and pushing elements to it by using Twig. Please refer to this article to know how to do that https://ourcodeworld.com/articles/read/622/how-to-push-an-item-to-an-array-in-twig-easily
Thank you for sharing the above example,
I have created array (eventArray) and marge the data in it.
Do you have any response for the above ?
The view does not support using variables between tab CSS, and JS like that. In the case of using JS and PHP code, I recommend using PHP code to query posts and localize data via the WP function
wp_localize_script() then you can use the array in view JS content as well.
Its seems like a custom solution to use the wp_localize_script() in the template.
No, unfortunately. It is not possible to use a variable between tabs in View (CSS, JS). I will inform the development team to consider supporting this case in future updates.