1: | <?php |
2: | |
3: | |
4: | |
5: | |
6: | |
7: | |
8: | |
9: | |
10: | |
11: | |
12: | |
13: | |
14: | function eventscalendar_block_init() { |
15: | $dir_path = EventPost()->plugin_path; |
16: | $dir = dirname( __DIR__ ); |
17: | |
18: | $block_js = 'build/calendar/index.js'; |
19: | wp_register_script('event-post-calendar-block-editor-script',plugins_url( $block_js, $dir ),array('wp-blocks','wp-editor','wp-components','wp-i18n','wp-element',),filemtime( "$dir_path/$block_js" )); |
20: | |
21: | wp_register_script('event-post-calendar-block-editor-script-front-end', plugins_url( '/build/calendar/event-calendar.js', $dir ), ['jquery'], false, true); |
22: | wp_set_script_translations( 'event-post-calendar-block-editor-script', 'event-post' ); |
23: | |
24: | \register_block_type( $dir_path . '/build/calendar', array( |
25: | 'editor_script' => 'event-post-calendar-block-editor-script', |
26: | 'script' => 'event-post-calendar-block-editor-script-front-end', |
27: | 'render_callback' => array(EventPost()->Shortcodes, 'shortcode_cal'), |
28: | )); |
29: | } |
30: | add_action( 'wp_loaded', 'eventscalendar_block_init' ); |
31: | |