PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 2.8.3
Kubio AI Page Builder v2.8.3
2.8.4 2.8.3 2.8.2 2.8.1 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.9.0 2.0.0 2.1.1 2.1.2 2.1.3 2.2.0 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.5 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.6.2 2.6.3 2.6.5 2.6.6 2.6.7 2.7.0 2.7.1 2.7.2 2.7.3 2.8.0
kubio / lib / full-site-editing / templates.php
kubio / lib / full-site-editing Last commit date
block-templates.php 1 year ago class-templates-list-table.php 2 years ago default-template-types.php 7 months ago full-site-editing.php 1 year ago get-block-templates.php 1 year ago template-loader.php 1 year ago template-parts.php 1 month ago templates.php 1 month ago
templates.php
88 lines
1 <?php
2
3 function kubio_get_template_types() {
4 $template_types = kubio_get_template_type_slugs();
5 $template_types = array_merge( $template_types, array( 'archive-product', 'single-product' ) );
6
7 return $template_types;
8 }
9
10 function kubio_is_block_template() {
11 global $_wp_current_template_content;
12
13 return apply_filters( 'kubio_is_block_template', ! ! $_wp_current_template_content );
14 }
15
16 function kubio_theme_has_kubio_block_support() {
17 return apply_filters( 'kubio/has_block_templates_support', false );
18 }
19
20 function kubio_theme_has_block_templates_support() {
21 $folders_to_check = array( 'full-site-editing/block-templates/index.html', 'block-templates/index.html', 'templates/index.html' );
22
23 $stylesheet_dir = get_stylesheet_directory();
24 $parent_dir = get_template_directory();
25
26 foreach ( $folders_to_check as $folder ) {
27 $candidate = $stylesheet_dir . '/' . $folder;
28 $candidate_parent = $parent_dir . '/' . $folder;
29 if ( file_exists( $candidate ) ) {
30 return true;
31 }
32
33 if ( $candidate_parent !== $candidate && file_exists( $candidate_parent ) ) {
34 return true;
35 }
36 }
37
38 return kubio_theme_has_kubio_block_support();
39 }
40
41 // skip unrelated templates to display
42 function kubio_skip_unrelated_templates( $post_templates, $theme, $post, $post_type ) {
43
44 $exclude = array();
45
46 switch ( $post_type ) {
47 case 'page':
48 $exclude[] = 'page';
49 break;
50 }
51
52 $default_template_types = array_diff( array_keys( kubio_get_default_template_types() ), $exclude );
53
54 foreach ( $post_templates as $slug => $name ) {
55 if ( in_array( $slug, $default_template_types ) ) {
56 unset( $post_templates[ $slug ] );
57 }
58 }
59
60 return $post_templates;
61 }
62
63 add_filter(
64 'theme_templates',
65 'kubio_skip_unrelated_templates',
66 100,
67 4
68 );
69
70 // view and edit the slug in quick settings
71
72 function kubio_template_slug_editor( $column_name, $post_type ) {
73 if ( $column_name === 'slug' && $post_type === 'wp_template' ) {
74 ?>
75 <fieldset class="inline-edit-col-left">
76 <div class="inline-edit-col">
77 <div class="inline-edit-group wp-clearfix">
78 <label class="inline-edit-status alignleft">
79 <span class="title"><?php esc_html_e( 'Slug', 'kubio' ); ?></span>
80 <span class="input-text-wrap"><input type="text" name="post_name" value="" /></span>
81 </label>
82 </div>
83 </div>
84 </fieldset>
85 <?php
86 }
87 }
88