PluginProbe
GutSlider – All in One Slider and Carousel Blocks for Gutenberg / 2.9.8
GutSlider – All in One Slider and Carousel Blocks for Gutenberg v2.9.8
3.1.0 3.0.0 2.13.2 2.13.1 2.13.0 trunk 1.0.0 2.1.0 2.10.0 2.10.1 2.11.0 2.11.1 2.11.2 2.11.3 2.11.4 2.12.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.1 2.5.3 2.5.4 2.5.5 2.6.1 All 56 releases
slider-blocks / includes / classes / class-blocks-category.php

class-blocks-category.php in GutSlider – All in One Slider and Carousel Blocks for Gutenberg 2.9.8, at includes/classes/class-blocks-category.php

39 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Register Blocks Category
4 * @package GutSliderBlocks
5 */
6
7 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
8
9 if ( ! class_exists( 'GutSlider_Blocks_Category' ) ) {
10
11 class GutSlider_Blocks_Category {
12
13 /**
14 * Constructor
15 */
16 public function __construct() {
17 $filter = version_compare( $GLOBALS['wp_version'], '5.7', '<' ) ? 'block_categories' : 'block_categories_all';
18 add_filter( $filter, [ $this, 'register_block_category' ], 10, 2 );
19 }
20
21 /**
22 * Register Block Category
23 * @param array $categories
24 * @param WP_Post $post
25 * @return array
26 */
27 public function register_block_category( $categories, $post ) {
28 $new_category = array(
29 'slug' => 'slider-blocks',
30 'title' => __( 'GutSlider Blocks', 'slider-blocks' ),
31 );
32 return array_merge( array( $new_category ), $categories );
33 }
34
35 }
36
37 new GutSlider_Blocks_Category(); // Initialize the class
38 }
39