PluginProbe
Gutenify – Visual Site Builder Blocks & Starter Templates / 1.0.5
Gutenify – Visual Site Builder Blocks & Starter Templates v1.0.5
1.9.0 1.8.0 1.7.0 1.6.6 1.6.5 1.6.4 trunk 0.0.1 0.0.2 0.0.3 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 All 74 releases
gutenify / inc / class-templates.php

class-templates.php in Gutenify – Visual Site Builder Blocks & Starter Templates 1.0.5, at inc/class-templates.php

138 lines 4.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Templates
4 *
5 * @package Gutenify
6 */
7
8 /**
9 * Gutenify_Templates
10 */
11 class Gutenify_Templates {
12 /**
13 * Gutenify_Templates constructor.
14 */
15 public function __construct() {
16 // Register custom post type.
17 add_action( 'init', array( $this, 'add_custom_post_type' ) );
18 // add_filter('views_edit-gutenify_kit', array( $this, 'add_kit_import_area' ), 1);
19 // add_action('admin_notices', array( $this, 'add_kit_import_area' ), 10);
20 }
21
22 /**
23 * Register custom post type.
24 */
25 public function add_custom_post_type() {
26 register_post_type(
27 'gutenify_template',
28 array(
29 'labels' => array(
30 'name' => _x( 'Templates', 'Post Type General Name' ),
31 'singular_name' => _x( 'Template', 'Post Type Singular Name' ),
32 'menu_name' => __( 'Gutenify' ),
33 'parent_item_colon' => __( 'Parent Template' ),
34 'all_items' => __( 'Templates' ),
35 'view_item' => __( 'View Template' ),
36 'add_new_item' => __( 'Add New Template' ),
37 'add_new' => __( 'Add New' ),
38 'edit_item' => __( 'Edit Template' ),
39 'update_item' => __( 'Update Template' ),
40 'search_items' => __( 'Search Template' ),
41 'not_found' => __( 'Not Found' ),
42 'not_found_in_trash' => __( 'Not found in Trash' ),
43 ),
44 'public' => false, // true?
45 'publicly_queryable' => false, // true?
46 'has_archive' => false,
47 'show_ui' => true,
48 'exclude_from_search' => true,
49 'show_in_nav_menus' => false,
50 'rewrite' => false,
51 // phpcs:ignore
52 'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode( file_get_contents( GUTENIFY_PLUGIN_DIR . 'assets/images/gutenify-logo.svg' ) ),
53 'menu_position' => 57,
54 'hierarchical' => false,
55 'show_in_menu' => true,
56 'show_in_admin_bar' => true,
57 'show_in_rest' => true,
58 'taxonomies' => array(
59 'gutenify_template_category',
60 ),
61 'capability_type' => 'post',
62 'supports' => array(
63 'title',
64 'editor',
65 'thumbnail',
66 'custom-fields',
67 ),
68 )
69 );
70
71 register_taxonomy(
72 'gutenify_template_category',
73 'gutenify_template',
74 array(
75 'label' => esc_html__( 'Categories' ),
76 'labels' => array(
77 'menu_name' => esc_html__( 'Categories' ),
78 ),
79 'rewrite' => false,
80 'hierarchical' => true,
81 'publicly_queryable' => false,
82 'show_in_nav_menus' => false,
83 'show_in_rest' => true,
84 'show_admin_column' => true,
85 )
86 );
87
88
89 $gutenify_kit_post_type_args = apply_filters( 'gutenify_kit_post_type_args', array(
90 'labels' => array(
91 'name' => _x( 'Templates Kit', 'Post Type General Name' ),
92 'singular_name' => _x( 'Template Kit', 'Post Type Singular Name' ),
93 'menu_name' => __( 'Gutenify' ),
94 'parent_item_colon' => __( 'Parent Template Kit' ),
95 'all_items' => __( 'Template Kits' ),
96 'view_item' => __( 'View Template Kit' ),
97 'add_new_item' => __( 'Add New Template Kit' ),
98 'add_new' => __( 'Add New' ),
99 'edit_item' => __( 'Edit Template Kit' ),
100 'update_item' => __( 'Update Template Kit' ),
101 'search_items' => __( 'Search Template Kit' ),
102 'not_found' => __( 'Not Found' ),
103 'not_found_in_trash' => __( 'Not found in Trash' ),
104 ),
105 'public' => false, // true?
106 'publicly_queryable' => false, // true?
107 'has_archive' => false,
108 'show_ui' => true,
109 'exclude_from_search' => true,
110 'show_in_nav_menus' => false,
111 'rewrite' => false,
112 // 'menu_position' => 57,
113 'hierarchical' => false,
114 'show_in_menu' => false,
115 'show_in_admin_bar' => false,
116 'show_in_rest' => true,
117 'capability_type' => 'post',
118 // 'capabilities' => array(
119 // 'create_posts' => false,
120 // ),
121 'supports' => array(
122 'title',
123 'editor',
124 'thumbnail',
125 // 'custom-fields',
126 ),
127 ) );
128 register_post_type( 'gutenify_kit', $gutenify_kit_post_type_args );
129 }
130
131 public function add_kit_import_area() {
132 // if ($post->post_type != 'event') return false;
133 echo '<div id="gutenify-kit-upload-wrap"></div>';
134 }
135 }
136
137 new Gutenify_Templates();
138