{"id":12722,"date":"2023-05-08T17:19:13","date_gmt":"2023-05-08T14:19:13","guid":{"rendered":"https:\/\/europe.wordcamp.org\/2023\/?post_type=wcb_session&#038;p=12722"},"modified":"2023-06-05T12:52:38","modified_gmt":"2023-06-05T09:52:38","slug":"from-shortcode-to-block","status":"publish","type":"wcb_session","link":"https:\/\/europe.wordcamp.org\/2023\/session\/from-shortcode-to-block\/","title":{"rendered":"From shortcode to block"},"content":{"rendered":"\n<p>In this workshop you will learn how to adapt a shortcode-based plugin so that it also renders content in a custom block for use in the WordPress editor. The plugin will therefore no longer need to rely on the build-in Shortcode block to render the content which can instead be inserted as a block.<\/p>\n\n\n\n<p>When converting a shortcode to a custom block it is usually best to do it by creating a dynamic block rather than a static block.<\/p>\n\n\n\n<p>Starting with a scaffolded project, as a participant in this workshop you will go on to build out a dynamic block that works with a CPT (Custom Post Type) and a CT (Custom Taxonomy). You will learn how to use the hooks provided by the @wordpress\/core-data package to pull content into the editor whilst also ensuring that the content is correctly rendered in the front-end. You will also learn how to use block attributes both in the editor and in the front-end.<\/p>\n\n\n\n<p>You will learn how a dynamic block differs from a static block and the use cases for each.<\/p>\n\n\n\n<p>If you already have, or are thinking of building, a plugin that uses a shortcode to render content and would like to learn how to render that content in a block as well then this workshop is for you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;In this workshop you will learn how to adapt a shortcode-based plugin so that it also renders content in a custom block for use in the WordPress editor. The plugin will therefore no longer need to rely on the build-in Shortcode block to render the content which can instead be inserted as a block.<\/p>\n<p>When converting a shortcode to a custom block it is usually best to do it by creating a dynamic block rather than a static block.<\/p>\n<p>Starting with a scaffolded project, as a participant in this workshop you will go on to build out a dynamic block that works with a CPT (Custom Post Type) and a CT (Custom Taxonomy). You will learn how to use the hooks provided by the @wordpress\/core-data package to pull content into the editor whilst also ensuring that the content is correctly rendered in the front-end. You will also learn how to use block attributes both in the editor and in the front-end.<\/p>\n<p>You will learn how a dynamic block differs from a static block and the use cases for each.<\/p>\n<p>If you already have, or are thinking of building, a plugin that uses a shortcode to render content and would like to learn how to render that content in a block as well then this workshop is for you.&#8221;<\/p>\n","protected":false},"author":13958698,"featured_media":16497,"template":"","meta":{"jetpack_post_was_ever_published":false,"_wcpt_session_time":1686308400,"_wcpt_session_duration":7200,"_wcpt_session_type":"session","_wcpt_session_slides":"","_wcpt_session_video":"","_wcpt_speaker_id":[12683],"footnotes":""},"session_track":[82],"session_category":[],"class_list":["post-12722","wcb_session","type-wcb_session","status-publish","has-post-thumbnail","hentry","wcb_track-workshop-2"],"jetpack_shortlink":"https:\/\/wp.me\/pdWJfM-3jc","jetpack_sharing_enabled":true,"session_date_time":{"date":"9 June 2023","time":"14:00"},"session_speakers":[{"id":"12683","slug":"michael-burridge","name":"Michael Burridge","link":"https:\/\/europe.wordcamp.org\/2023\/speaker\/michael-burridge\/"}],"session_cats_rendered":null,"_links":{"self":[{"href":"https:\/\/europe.wordcamp.org\/2023\/wp-json\/wp\/v2\/sessions\/12722","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/europe.wordcamp.org\/2023\/wp-json\/wp\/v2\/sessions"}],"about":[{"href":"https:\/\/europe.wordcamp.org\/2023\/wp-json\/wp\/v2\/types\/wcb_session"}],"version-history":[{"count":1,"href":"https:\/\/europe.wordcamp.org\/2023\/wp-json\/wp\/v2\/sessions\/12722\/revisions"}],"predecessor-version":[{"id":12724,"href":"https:\/\/europe.wordcamp.org\/2023\/wp-json\/wp\/v2\/sessions\/12722\/revisions\/12724"}],"speakers":[{"embeddable":true,"href":"https:\/\/europe.wordcamp.org\/2023\/wp-json\/wp\/v2\/speakers\/12683"}],"author":[{"embeddable":true,"href":"https:\/\/europe.wordcamp.org\/2023\/wp-json\/wporg\/v1\/users\/mburridge"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/europe.wordcamp.org\/2023\/wp-json\/wp\/v2\/media\/16497"}],"wp:attachment":[{"href":"https:\/\/europe.wordcamp.org\/2023\/wp-json\/wp\/v2\/media?parent=12722"}],"wp:term":[{"taxonomy":"wcb_track","embeddable":true,"href":"https:\/\/europe.wordcamp.org\/2023\/wp-json\/wp\/v2\/session_track?post=12722"},{"taxonomy":"wcb_session_category","embeddable":true,"href":"https:\/\/europe.wordcamp.org\/2023\/wp-json\/wp\/v2\/session_category?post=12722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}