Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

main plugin class skeleton

as a part of this tutorial https://generatewp.com/reusable-content-blocks-wordpress

/**
* GWP_content_blocks
*/
class GWP_content_blocks{
    /**
     * __construct 
     * Class constructor
     */
    function __construct(){}

    /**
     * hooks
     * Used to hook all our functions
     * @return void
     */
    function hooks(){}

    /**
     * register_content_blocks_cpt
     * this will be generated using our Custom post type generator
     * @return void
     */
    function register_content_blocks_cpt(){}

    /**
     * render_content_block
     * this is we actually render the content block 
     * @param  int $id content block id
     * @return string  rendered content block
     */
    function render_content_block( $id ){}
}
global $GWP_cb;
$GWP_cb = new GWP_content_blocks();