-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.php
More file actions
48 lines (40 loc) · 1.13 KB
/
Copy pathplugin.php
File metadata and controls
48 lines (40 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* Plugin Name: Mark Tate - Timeline Block
* Description: Timeline UI Component
* Version: 0.0.1
*/
defined( 'ABSPATH' ) || exit;
function timeline_block() {
// automatically load dependencies and version
$asset_file = include( plugin_dir_path( __FILE__ ) . 'build/index.asset.php');
/** Register timeline block */
wp_register_script(
'timeline',
plugins_url( 'build/index.js', __FILE__ ),
$asset_file['dependencies'],
$asset_file['version']
);
/** Register timeline block editor styles */
wp_register_style(
'timeline-editor',
plugins_url('src/edit.css', __FILE__ ),
array( 'wp-edit-blocks' ),
1,
'all'
);
/** Register `react-vertical-timeline-component` third party styles */
wp_register_style(
'react-vertical-timeline-component',
plugins_url('node_modules/react-vertical-timeline-component/style.min.css', __FILE__ ),
array(),
1,
'all'
);
wp_enqueue_style('react-vertical-timeline-component');
register_block_type( 'mark-tate/timeline-block', array(
'editor_style' => 'timeline-editor',
'editor_script' => 'timeline',
) );
}
add_action( 'init', 'timeline_block' );