| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
|
| 6 |
// register category |
| 7 |
function eshb_block_categories( $block_categories, $editor_context ) { |
| 8 |
///if ( ! empty( $editor_context->post ) ) { |
| 9 |
$attr = array( |
| 10 |
array( |
| 11 |
'slug' => 'easy-hotel', |
| 12 |
'title' => __( 'Easy Hotel', 'easy-hotel' ), |
| 13 |
) |
| 14 |
); |
| 15 |
$block_categories = array_merge( $attr, $block_categories ); |
| 16 |
|
| 17 |
//} |
| 18 |
return $block_categories; |
| 19 |
} |
| 20 |
add_filter( 'block_categories_all', 'eshb_block_categories', 999999, 2 ); |
| 21 |
|
| 22 |
|
| 23 |
add_action( 'enqueue_block_assets', 'eshb_enqueue_block_styles' ); |
| 24 |
add_action( 'enqueue_block_editor_assets', 'eshb_enqueue_block_styles' ); |
| 25 |
function eshb_enqueue_block_styles() { |
| 26 |
|
| 27 |
// if swier not existing |
| 28 |
if (!wp_style_is('swiper', 'enqueued')) { |
| 29 |
wp_enqueue_style( 'swiper', ESHB_PL_URL . 'public/assets/css/swiper-bundle.min.css', array(), ESHB_VERSION, 'all' ); |
| 30 |
} |
| 31 |
if (!wp_script_is('eshb-swiper', 'enqueued')) { |
| 32 |
wp_enqueue_script( 'eshb-swiper', ESHB_PL_URL . 'public/assets/js/swiper-bundle.min.js', array(),'12.0.3',false ); |
| 33 |
} |
| 34 |
|
| 35 |
// register plugin style if not exist |
| 36 |
//if ( ! wp_style_is( 'eshb-style', 'registered' ) ) { |
| 37 |
wp_register_style( |
| 38 |
'eshb-style', |
| 39 |
ESHB_PL_URL . 'public/assets/css/public.css', |
| 40 |
array(), |
| 41 |
ESHB_VERSION |
| 42 |
); |
| 43 |
//} |
| 44 |
|
| 45 |
|
| 46 |
} |
| 47 |
|
| 48 |
// include blocks |
| 49 |
require_once ESHB_PL_PATH . 'public/includes/gutenberg/blocks/class.block-helper.php'; |
| 50 |
require_once ESHB_PL_PATH . 'public/includes/gutenberg/blocks/accomodation-grid/accomodation-grid.php'; |
| 51 |
require_once ESHB_PL_PATH . 'public/includes/gutenberg/blocks/search-form/search-form.php'; |
| 52 |
require_once ESHB_PL_PATH . 'public/includes/gutenberg/blocks/booking-form/booking-form.php'; |
| 53 |
require_once ESHB_PL_PATH . 'public/includes/gutenberg/blocks/accomodation-gallery/accomodation-gallery.php'; |
| 54 |
require_once ESHB_PL_PATH . 'public/includes/gutenberg/blocks/accomodation-info/accomodation-info.php'; |
| 55 |
require_once ESHB_PL_PATH . 'public/includes/gutenberg/blocks/check-in-out-times/check-in-out-times.php'; |
| 56 |
require_once ESHB_PL_PATH . 'public/includes/gutenberg/blocks/availability-calendars/availability-calendars.php'; |
| 57 |
require_once ESHB_PL_PATH . 'public/includes/gutenberg/blocks/accomodation-slider/accomodation-slider.php'; |
| 58 |
|