September 04, 2019
Working with Gutenberg, I’ve learned how to build custom blocks to show content inline on a page, but I thought there could be an easier way that building a block, or a custom template.With a custom shortcode (whether it links to the template with the block to show, or includes code to displays additional options like category or number of items), building custom blocks and templates is less necessary.
function my_form_shortcode() { ob_start(); get_template_part('my_form_template'); return ob_get_clean(); } add_shortcode( 'my_form_shortcode', 'my_form_shortcode' );