-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtabs.php
49 lines (43 loc) · 1.01 KB
/
tabs.php
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
49
<?php
/**
* Plugin Name: Tabs
* Description: Tabs block created using the Interactivity API.
* Version: 0.1.0
* Requires at least: 6.6
* Requires PHP: 7.2
* Author: djuric
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: tabs
*
* @package tabs
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Registers multiple block types from metadata loaded from a file.
*/
add_action(
'init',
function () {
$build_dir = __DIR__ . '/build/blocks';
if ( ! file_exists( $build_dir ) ) {
return;
}
$block_json_files = glob( $build_dir . '/*/block.json' );
foreach ( $block_json_files as $block_json_file ) {
register_block_type( dirname( $block_json_file ) );
}
}
);
/**
* Fix for Dashicons styles bug
* See https://github.com/WordPress/gutenberg/issues/53528
*/
add_action(
'enqueue_block_assets',
function () {
wp_enqueue_style( 'dashicons' );
}
);