-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
98 lines (80 loc) · 2.57 KB
/
index.php
File metadata and controls
98 lines (80 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
/**
* Plugin Name: WP Shopify Visual Builder
* Description: A Gutenberg powered Visual Builder for WP Shopify
* Version: 0.0.1
* Plugin URI: https://wpshop.io
* Author: WP Shopify
* Author URI: https://wpshop.io
* Text Domain: query-monitor
* Domain Path: /languages/
* Requires PHP: 5.3.6
*/
defined( 'ABSPATH' ) || die();
function wp_shopify_visual_builder_register_post_type() {
error_log('----- wp_shopify_visual_builder_register_post_type 1 -----');
// if (!is_admin()) {
// error_log('----- wp_shopify_visual_builder_register_post_type 2 -----');
// exit;
// }
if (post_type_exists('wp_shopify_visual_builder')) {
return;
}
register_post_type(
'wps_visual_builder',
[
'label' => __('Shopify Visual Builder', 'wpshopify'),
'description' => __('CPT to enable the WP Shopify Visual Builder', 'wpshopify'),
'supports' => [
'editor'
],
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 100,
'menu_icon' => 'dashicons-megaphone',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => false,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => false,
'capability_type' => 'post',
'rewrite' => false,
'show_in_rest' => true
]
);
}
function wp_shopify_visual_builder_scripts() {
wp_enqueue_script(
'wpshopify-visual-builder-js',
plugins_url( 'index.js' , __FILE__ ),
[
'wp-blocks',
'wp-element',
'wp-editor',
'wp-components',
'wp-i18n',
],
'',
true
);
}
function wp_shopify_visual_builder_styles() {
wp_enqueue_style('wpshopify-visual-builder-css', plugins_url( 'style.css' , __FILE__ ), []);
}
function wp_shopify_visual_builder_allowed_block_types( $allowed_blocks ) {
return [
'wpshopify/single-product',
'wpshopify/products',
'wpshopify/buy-button'
];
}
function Bootstrap() {
add_action('init', 'wp_shopify_visual_builder_register_post_type' );
add_action('admin_enqueue_scripts', 'wp_shopify_visual_builder_scripts');
add_action('admin_enqueue_scripts', 'wp_shopify_visual_builder_styles');
add_filter('allowed_block_types', 'wp_shopify_visual_builder_allowed_block_types' );
}
Bootstrap();