# slider-blocks/2.10.1/includes/classes/class-blocks-category.php

GutSlider – All in One Slider and Carousel Blocks for Gutenberg, version 2.10.1. 39 lines.

- Page: https://pluginprobe.com/plugins/slider-blocks/2.10.1/code/includes/classes/class-blocks-category.php
- Raw: https://pluginprobe.com/plugins/slider-blocks/2.10.1/raw/includes/classes/class-blocks-category.php
- Modified: 2025-05-22T11:54:56+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/slider-blocks/2.10.1/code/includes/classes/class-blocks-category.php#L10-L20`.

```php
<?php 
/**
 * Register Blocks Category
 * @package GutSliderBlocks
 */

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.

if ( ! class_exists( 'GutSlider_Blocks_Category' ) ) {

    class GutSlider_Blocks_Category {

        /**
         * Constructor
         */
        public function __construct() {
            $filter = version_compare( $GLOBALS['wp_version'], '5.7', '<' ) ? 'block_categories' : 'block_categories_all';
            add_filter( $filter, [ $this, 'register_block_category' ], 10, 2 );
        }

        /**
         * Register Block Category
         * @param array $categories
         * @param WP_Post $post
         * @return array
         */
        public function register_block_category( $categories, $post ) {
            $new_category = array(
                'slug'  => 'slider-blocks',
                'title' => __( 'GutSlider Blocks', 'slider-blocks' ),
            );
            return array_merge( array( $new_category ), $categories );
        }

    }

    new GutSlider_Blocks_Category(); // Initialize the class
}

```
