What is the recommended / best way to do this: Event calendar post/type in a block-based theme?
my question is this: assume I have a php-themed WordPress site with an event calendar page template that’s using post type “event”, which in turn has a lot of custom fields that hold the post meta. On the front end, a long list of events is output based on a custom query. This is a very common real world scenario.
In a block based theme, what would be the best way to handle this scenario? Assuming that it’s still useful to have a distinct, queryable representation of every event with its custom fields in the data base instead of a simple list of html blocks.
The introduction of the block-editor has made blocks the smallest data container, yet one that cannot be idenpendently queried and reassembled. There’s also no admin UI for accessing individual blocks independent of their container posts. So for all aspects that require querying, posts are still the smallest data container in WordPress.
So what is the best way to go about this?
For the input side I can thus see two options:
A custom block with a locked block template for the “event post type” to input the event info, and ideally save to post meta? I can see how it would then be possible to query even according to invisible post meta in the frontend.
Or a lockable? block pattern for the “event post type” post which will save everything in it to post-content and potentially needs to be parsed in some way when queried/rendered. I’m not sure how invisible post meta could be/ would be handled in this scenario.
For the output side
- I would either (probably) need a custom output query loop block that takes care of the query and dynamic rendering (and backend representation).
- or possibly use the query block if specific event query can be supported.
I consider this one of the most common current use cases, so I’m hoping someone has already thought about this, given that everything is supposed to become block based in the future.
Thanks for your ideas and consideration!
Leave an answer