Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC: Transform [wpt_productions] into query-block variation #330

Open
12 of 15 tasks
carstingaxion opened this issue Feb 19, 2024 · 1 comment
Open
12 of 15 tasks

POC: Transform [wpt_productions] into query-block variation #330

carstingaxion opened this issue Feb 19, 2024 · 1 comment

Comments

@carstingaxion
Copy link

carstingaxion commented Feb 19, 2024

From all the Shortcodes, [wpt_productions] seemed to be the best candidate to validate the idea of using block-transforms on the existing shortcodes to migrate into the new era of blocks.

Bildschirmaufzeichnung.vom.19.02.2024.01.32.16.webm

Ressources

Steps I did

  • Update register_post_type() arguments of wp_theatre_prod with: 'show_in_rest' => true,
    • Write a dedicated filter on this
  • Create a block that transforms the shortcode(s) into one or more block
    • Hide block from inserter, as it is only needed to register the transforms
  • Transform shortcode attributes like order into block-attributes
    is working for most, not all attributes out of the box
  • Transform template fields of an enclosing shortcode like {{excerpt}} into innerBlocks

working, so far

1.

  • [wpt_productions]
  • [wpt_productions limit=1]
  • [wpt_productions cat=2]
  • [wpt_productions post__not_in=11,12]
  • [wpt_productions order=desc]
  • [wpt_productions limit=8 cat=2 post__not_in=11,12 order=desc]
  • [wpt_productions fields="thumbnail,title,summary"] and some more fields

2.

  • [wpt_event_ticket_button]
  • [wpt_event_ticket_button id=123]
button.mp4

Next steps

  1. I would go on creating dedicated issues for each shortcode. This should help while developing and documenting the necessary steps, parameters, fields and use-cases.
  2. Create transforms for all existing shortcodes and all its parameters to achieve best compatibility with existing installations

I think, that all of this, could be done independently from our decisions whether to carry out an own event-management solution or not.

@carstingaxion carstingaxion changed the title Transform [wpt_productions] into query-block variation POC: Transform [wpt_productions] into query-block variation Feb 19, 2024
@carstingaxion
Copy link
Author

Find the working code in figuren-theater/theater-production-blocks at feature/wpt-shortcode-to-query-block, if you want to give it a try @slimndap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant