<?php
    

class agile_tix_block{
    
    //add_action('init', 'ats_register_custom_block');
    function ats_register_custom_block() {
        register_block_type('namespace/block-name', array(
            'editor_script' => 'block-editor-script', // the script for the block editor
            'render_callback' => 'agile_tix_block::ats_render_custom_block', 
        ));
    }



    static function ats_render_custom_block()
    {
         $post_id = get_the_ID();

        // Retrieve the post meta data
        $meta = get_post_meta($post_id);

        $content = '';
        if (!empty($meta)) {
            $meta = 'default value'; // If no meta exists, use a default value
            //$content = '';
        }

        return '<div class="custom-block">
                    <p>$content: ' . esc_html($content) . '</p>
                </div>';
    }

}


