PluginProbe
BlockSpare – Gutenberg Blocks, AI Content Generator & Site Builder for News, Magazine & Blogs / 5.0.1
BlockSpare – Gutenberg Blocks, AI Content Generator & Site Builder for News, Magazine & Blogs v5.0.1
5.0.1 4.1.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 2.1.2 2.5.0 2.5.3 All 39 releases
blockspare / inc / theme-builder / class-blockspare-tb-taxonomy.php

class-blockspare-tb-taxonomy.php in BlockSpare – Gutenberg Blocks, AI Content Generator & Site Builder for News, Magazine & Blogs 5.0.1, at inc/theme-builder/class-blockspare-tb-taxonomy.php

67 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Registers the `blockspare_template_type` taxonomy.
5 *
6 * @package Blockspare
7 */
8
9 defined('ABSPATH') || exit;
10
11
12 class Blockspare_TB_Template_Type_Taxonomy
13 {
14
15 const SLUG = 'blockspare_template_type';
16
17
18 const TYPES = array(
19 'header' => 'Header',
20 'footer' => 'Footer',
21 'front_page' => 'Front Page',
22 'single' => 'Singular',
23 'archive' => 'Archive',
24 'search' => 'Search Results',
25 'category' => 'Category',
26 'author' => 'Author',
27 'tag' => 'Tag',
28 'date' => 'Date Archive',
29 '404' => '404 Page',
30 );
31
32 /**
33 * Registers the taxonomy and seeds its terms.
34 */
35 public function register()
36 {
37 register_taxonomy(
38 self::SLUG,
39 Blockspare_TB_Template_Post_Type::SLUG,
40 array(
41 'labels' => array(
42 'name' => __('Template Types', 'blockspare'),
43 'singular_name' => __('Template Type', 'blockspare'),
44 ),
45 'public' => false,
46 'show_ui' => false, // Managed programmatically, not by users, to keep it in sync with the
47 'show_in_rest' => true,
48 'hierarchical' => false,
49 )
50 );
51
52 $this->seed_terms();
53 }
54
55
56 private function seed_terms()
57 {
58 foreach (self::TYPES as $slug => $label) {
59 $slug = (string) $slug;
60
61 if (! term_exists($slug, self::SLUG)) {
62 wp_insert_term($label, self::SLUG, array('slug' => $slug));
63 }
64 }
65 }
66 }
67