| 1 |
<?php |
| 2 |
namespace PFB; |
| 3 |
|
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; |
| 6 |
} |
| 7 |
|
| 8 |
class BlockCategory { |
| 9 |
|
| 10 |
public function __construct() { |
| 11 |
add_filter( 'block_categories_all', [ $this, 'register_category' ], 10, 2 ); |
| 12 |
} |
| 13 |
|
| 14 |
public function register_category( $categories, $post ) { |
| 15 |
|
| 16 |
array_unshift( $categories, [ |
| 17 |
'slug' => 'portfolio', |
| 18 |
'title' => __( 'Portfolio', 'portfolio-block' ), |
| 19 |
]); |
| 20 |
|
| 21 |
return $categories; |
| 22 |
} |
| 23 |
} |
| 24 |
|