'render_snippetz', ); foreach ( $blocks as $block => $function ) { register_block_type( __DIR__ . "/build/$block", array( 'render_callback' => array( $this, $function ), ) ); } } /** * Render snippetz block. * * @since 2.1.0 * * @param array $attributes Block attributes. * @return \WP_Post|string `WP_Post` instance on success or error message on failure. */ public function render_snippetz( $attributes ) { $id = absint( $attributes['snippetId'] ); $class = isset( $attributes['className'] ) ? $attributes['className'] : ''; $snippet_type = Functions::get_snippet_type( get_post( $id ) ); $output = Functions::get_snippet_content( $id, array( 'class' => $class, 'is_block' => true, ) ); return $output; } }