| 1 |
<?php |
| 2 |
|
| 3 |
namespace BPMP; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) { |
| 6 |
exit; |
| 7 |
} |
| 8 |
|
| 9 |
class Init { |
| 10 |
function __construct() { |
| 11 |
add_action( 'init', [ $this, 'onInit' ] ); |
| 12 |
} |
| 13 |
|
| 14 |
function onInit(){ |
| 15 |
register_block_type(BPMP_DIR_PATH . '/build'); |
| 16 |
|
| 17 |
register_post_type('audio_player_block', [ |
| 18 |
'label' => __( 'Audio Player', 'audio-player-block' ), |
| 19 |
'labels' => [ |
| 20 |
'add_new' => _x( 'Add New', 'audio_player_block', 'audio-player-block' ), |
| 21 |
'add_new_item' => __( 'Add New Player', 'audio-player-block' ), |
| 22 |
'edit_item' => __( 'Edit Player', 'audio-player-block' ), |
| 23 |
'not_found' => __( 'There was no player please add one', 'audio-player-block' ) |
| 24 |
], |
| 25 |
'show_in_rest' => true, |
| 26 |
'public' => true, |
| 27 |
'publicly_queryable' => false, |
| 28 |
'menu_icon' => 'dashicons-format-audio', |
| 29 |
'item_published' => 'Audio Player Block Published', |
| 30 |
'item_updated' => 'Audio Player Block Updated', |
| 31 |
'template' => [['bpmp/mp3-player']], |
| 32 |
'template_lock' => 'all', |
| 33 |
]); |
| 34 |
|
| 35 |
} |
| 36 |
|
| 37 |
} |