| @@ -7,22 +7,31 @@ | ||
| 7 | 7 | /** |
| 8 | 8 | * Add Custom Block Category for Give blocks |
| 9 | 9 | */ |
| 10 | 10 | function give_blocks_category( $categories, $post ) { |
| 11 | - return array_merge( | |
| 12 | - $categories, | |
| 13 | - array( | |
| 14 | - array( | |
| 15 | - 'slug' => 'give', | |
| 16 | - 'title' => __( 'Give', 'give' ), | |
| 17 | - ), | |
| 18 | - ) | |
| 19 | - ); | |
| 11 | + return array_merge( | |
| 12 | + $categories, | |
| 13 | + array( | |
| 14 | + array( | |
| 15 | + 'slug' => 'give', | |
| 16 | + 'title' => __( 'Give', 'give' ), | |
| 17 | + ), | |
| 18 | + ) | |
| 19 | + ); | |
| 20 | 20 | } |
| 21 | -add_filter( 'block_categories', 'give_blocks_category', 10, 2 ); | |
| 22 | 21 | |
| 23 | 22 | /** |
| 23 | + * @since 2.19.0 The `block_categories` filter is deprecated as of WordPress 5.8 | |
| 24 | + */ | |
| 25 | +if ( version_compare( get_bloginfo( 'version' ), '5.8', '>=' ) ) { | |
| 26 | + add_filter( 'block_categories_all', 'give_blocks_category', 10, 2 ); | |
| 27 | +} else { | |
| 28 | + add_filter( 'block_categories', 'give_blocks_category', 10, 2 ); | |
| 29 | +} | |
| 30 | + | |
| 31 | +/** | |
| 24 | 32 | * Blocks |
| 25 | 33 | */ |
| 26 | 34 | require_once GIVE_PLUGIN_DIR . 'blocks/donation-form/class-give-donation-form-block.php'; |
| 27 | 35 | require_once GIVE_PLUGIN_DIR . 'blocks/donation-form-grid/class-give-donation-form-grid-block.php'; |
| 28 | 36 | require_once GIVE_PLUGIN_DIR . 'blocks/donor-wall/class-give-donor-wall.php'; |
| 37 | + | |