| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- // Register Newsletter Custom Post Type
- require 'tsu_newsletter_custom_post.php';
- // Register Custom Block Category
- add_filter( 'block_categories_all', function($categories) {
-
- // Set Category Slug
- $new_slug = 'tsu-category';
- // Set Category Title
- $new_title = 'To się uda';
- $has_category = false;
- foreach($categories as $category) {
- if($category === [ 'slug' => $new_slug, 'title' => $new_title]) {
- $has_category = true;
- }
- }
- if(!$has_category) {
- $categories[] = array(
- 'slug' => $new_slug,
- 'title' => $new_title
- );
- };
-
- return $categories;
- });
- // Register Newsletter Custom Block
- add_action( 'init', 'add_newsletter_block' );
- function add_newsletter_block() {
- register_block_type( __DIR__ . '/build' );
- }
|