-
Notifications
You must be signed in to change notification settings - Fork 0
/
grid-masonry-for-guten-blocks.php
147 lines (128 loc) · 3.78 KB
/
grid-masonry-for-guten-blocks.php
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?php
/**
* Plugin Name: Grid Masonry for Guten blocks
* Description: Seamless Masonry Layouts with Gutenberg allows users to display their posts and media in a masonry design with integrated lightbox options.
* Requires at least: 5.9
* Requires PHP: 7.4
* Version: 1.0.1
* Author: <a href="https://www.zealousweb.com/">ZealousWeb</a>
* License: GPLv3 or later License
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
* Text Domain: grid-masonry-for-guten-blocks
*
* @category ZealBlocks
* @package Grid-Masonry-for-Guten-Blocks
* @author ZealousWeb <[email protected]>
* @copyright 2024 ZealousWeb
* @license GPLv3 or later License
* @link http://www.gnu.org/licenses/gpl-3.0.html
*/
// Exit if accessed directly.
if (!defined('ABSPATH')) {
exit;
}
if (!defined('GMFGB_FILE')) {
define('GMFGB_FILE', __FILE__);
}
if (!defined('GMFGB_DIR')) {
define('GMFGB_DIR', dirname(__FILE__));
}
if (!defined('GMFGB_BLOCK_PLUGIN_NAME')) {
define('GMFGB_BLOCK_PLUGIN_NAME', 'Grid Masonry for Gutenberg');
}
if (!defined('GMFGB_VERSION')) {
define('GMFGB_VERSION', '1.0.1');
}
if (!defined('GMFGB')) {
define('GMFGB', 'GRID MASONRY');
}
//print_r(plugin_dir_url(GMFGB_FILE ).GMFGB_BLOCK_PLUGIN_NAME);
// Add custom function file.
require_once GMFGB_DIR . '/inc/custom-functions.php';
/**
* Registers the block using the metadata loaded from the `block.json` file.
* Behind the scenes, it registers also all assets so they can be enqueued
* through the block editor in the corresponding context.
*
* @see https://developer.wordpress.org/reference/functions/register_block_type/
*/
/**
* Register block assets.
*
* @return void
*/
function Gmfgb_Plugin_init()
{
/** Masonry Library */
wp_enqueue_script(
'masonry-lib',
plugins_url('/inc/assets/js/3.0.6_dist_isotope.pkgd.min.js', __FILE__),
array('jquery'),
'3.0.6',
true
);
/** FancyBox/FancyApp Library */
wp_enqueue_script(
'fancyapp-lib',
plugins_url('/inc/assets/js/fancybox.umd.js', __FILE__),
array('jquery'),
'5.0.34',
true
);
/** Custom Plugin Script */
wp_enqueue_script(
'script-custom',
plugins_url('/inc/assets/js/script.js', __FILE__),
array('jquery', 'fancyapp-lib', 'masonry-lib'),
GMFGB_VERSION,
true
);
wp_enqueue_script(
'script-custom-border',
plugins_url('/inc/assets/js/border-none.js', __FILE__),
array('jquery', 'fancyapp-lib', 'masonry-lib'),
GMFGB_VERSION,
true
);
/** FancyBox/FancyApp Library CSS */
wp_enqueue_style(
'fancyapp-css',
plugins_url('/inc/assets/css/fancybox.css', __FILE__),
'5.0.34',
true
);
/** Custom Plugin Style */
wp_enqueue_style(
'front-styles',
plugins_url('/build/style-index.css', __FILE__),
GMFGB_VERSION,
true
);
/** Register Block */
register_block_type(__DIR__ . '/build');
}
add_action('init', 'Gmfgb_Plugin_init');
/**
* Created Category function
*
* @param array $categories - list of category.
*
* @return mixed Return description.
*/
function Gmfgb_Plugin_Block_categories( $categories )
{
if (array_search('zealblocks', array_column($categories, 'slug'), true) === false) {
return array_merge(
$categories,
array(
array(
'slug' => 'zealblocks',
'title' => __('ZealBlocks', 'grid-masonry-for-gutenberg'),
'icon' => '',
),
)
);
}
return $categories;
}
add_action('block_categories_all', 'Gmfgb_Plugin_Block_categories', 10, 2);