PluginProbe
Templateberg – Gutenberg Templates, WordPress Themes Template Kits & WordPress Templates / 1.1.0
Templateberg – Gutenberg Templates, WordPress Themes Template Kits & WordPress Templates v1.1.0
1.2.0 2.0.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9
templateberg / includes / lists / templates / gutenberg.php

gutenberg.php in Templateberg – Gutenberg Templates, WordPress Themes Template Kits & WordPress Templates 1.1.0, at includes/lists/templates/gutenberg.php

260 lines 13.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 $paged = get_query_var('paged')?get_query_var('paged'):1;
3 $templates_list = templateberg_get_gutenberg_templates($paged);
4 $templates_list_popular = get_transient('templateberg_gt_p_'.$paged);
5 $total_posts = get_transient('templateberg_gt_total');
6 $max_pages = get_transient('templateberg_gt_max');
7
8 /**
9 * Create Instance for Templateberg_Template_Lists_Data
10 *
11 * @since 1.0.0
12 * @access public
13 *
14 * @param
15 *
16 * @return object
17 */
18 templateberg_template_lists_data()->run($templates_list);
19 $data = templateberg_template_lists_data()->data;
20 ?>
21
22 <link rel="stylesheet" id="templateberg-dashboard-shortcode-css" href="<?php echo TEMPLATEBERG_URL . 'dist/list.css' ?>" type="text/css" media="all">
23
24 <div class="tb-list__template" role="document">
25 <div class="tb-list__sidebar">
26 <div class="tb-list__search">
27 <input class="tb-list__searchinput" type="text" id="" placeholder="Search" value="">
28 <i class="fas fa-search" tabindex="-1"></i>
29 </div>
30 <div class="tb-list__categories"><h3><?php echo esc_html__('Categories', 'templateberg'); ?></h3>
31 <div class="tb-list__categories-filter-wrap">
32 <ul class="tb-list__categories-wrap-tab">
33 <li class="tb-list__categories-tab-item tb-filter-active" data-id="all"><?php echo esc_html__('All', 'templateberg'); ?></li>
34 <li class="tb-list__categories-tab-item" data-id="free"><?php echo esc_html__('Free', 'templateberg'); ?></li>
35 <li class="tb-list__categories-tab-item" data-id="pro"><?php echo esc_html__('Pro', 'templateberg'); ?></li>
36 </ul>
37 </div>
38 <ul class="tb-list__cat_lists tb-cat-lists-all tb-cats-content-active">
39 <?php
40 $current_tab = '';
41 $current_tab_cats = array();
42 $count_items = templateberg_template_lists_data()->countItems;
43 if (isset($data['template-kits'])) {
44 $current_tab ='template-kits';
45 $current_tab_cats =$count_items['template-kits'];
46 } elseif (isset($data['templates'])) {
47 $current_tab ='templates';
48 $current_tab_cats =$count_items['templates'];
49 } elseif (isset($data['blocks'])) {
50 $current_tab ='blocks';
51 $current_tab_cats =$count_items['blocks'];
52 }
53 if (!empty($current_tab_cats)) {
54 foreach ($current_tab_cats as $cat => $count) {
55 if ($cat === 'all') {
56 ?>
57 <li class="tb-list__current_item">
58 <a href="#" data-cat="<?php echo esc_attr($cat);?>"><?php echo esc_html__('All Items', 'templateberg'); ?><span><?php echo $count;?></span></a>
59 </li>
60 <?php
61 } else {
62 ?>
63 <li class=""><a href="#" data-cat="<?php echo esc_attr($cat);?>"><?php echo esc_html(ucwords(str_replace("-", " ", $cat)));?><span><?php echo $count;?></span></a></li>
64 <?php
65 }
66 }
67 }
68 ?>
69 </ul>
70 <ul class="tb-list__cat_lists tb-cat-lists-free">
71 <?php
72 $count_items = templateberg_template_lists_data()->countFreeItems;
73 if (!empty($current_tab_cats)) {
74 foreach ($current_tab_cats as $cat => $count) {
75 if ($cat === 'all-free') {
76 ?>
77 <li class="tb-list__current_item">
78 <a href="#" data-cat="<?php echo esc_attr($cat);?>"><?php echo esc_html__('All Items', 'templateberg'); ?><span><?php echo $count;?></span></a>
79 </li>
80 <?php
81 } else {
82 ?>
83 <li class=""><a href="#" data-cat="<?php echo esc_attr($cat);?>"><?php echo esc_html(ucwords(str_replace("-", " ", $cat)));?><span><?php echo $count;?></span></a></li>
84 <?php
85 }
86 }
87 }
88 ?>
89 </ul>
90 <ul class="tb-list__cat_lists tb-cat-lists-pro">
91 <?php
92 $count_items = templateberg_template_lists_data()->countProItems;
93 if (!empty($current_tab_cats)) {
94 foreach ($current_tab_cats as $cat => $count) {
95 if ($cat === 'all-pro') {
96 ?>
97 <li class="tb-list__current_item">
98 <a href="#" data-cat="<?php echo esc_attr($cat);?>"><?php echo esc_html__('All Items', 'templateberg'); ?><span><?php echo $count;?></span></a>
99 </li>
100 <?php
101 } else {
102 ?>
103 <li class=""><a href="#" data-cat="<?php echo esc_attr($cat);?>"><?php echo esc_html(ucwords(str_replace("-", " ", $cat)));?><span><?php echo $count;?></span></a></li>
104 <?php
105 }
106 }
107 }
108 ?>
109 </ul>
110 </div>
111 </div>
112 <div class="tb-list__container">
113 <div>
114 <span class="tb-list__btn"><i class="fas fa-bars"></i></span>
115 </div>
116 <div class="tb-list__header">
117 <div class="tb-list__links">
118 <?php
119 $current_tab_data = array();
120 if (isset($data['template-kits'])) {
121 if (empty($current_tab_data)) {
122 $current_tab_data = $data['template-kits'];
123 }
124 ?>
125 <a href="#" class="tb-list__cat_btn <?php echo $current_tab ==='template-kits'?'is-selected':'';?>" data-type="template-kits">
126 <i class="fas fa-images"></i>
127 <?php echo esc_html__('Template Kits', 'templateberg'); ?>
128 </a>
129 <?php
130 }
131 if (isset($data['templates'])) {
132 if (empty($current_tab_data)) {
133 $current_tab_data = $data['templates'];
134 }
135 ?>
136 <a href="#" class="tb-list__cat_btn <?php echo $current_tab ==='templates'?'is-selected':'';?>" data-type="templates">
137 <i class="far fa-file"></i>
138 <?php echo esc_html__('Templates', 'templateberg'); ?>
139 </a>
140 <?php
141 }
142 if (isset($data['blocks'])) {
143 if (empty($current_tab_data)) {
144 $current_tab_data = $data['blocks'];
145 }
146 ?>
147 <a href="#" class="tb-list__cat_btn <?php echo $current_tab ==='blocks'?'is-selected':'';?>" data-type="blocks">
148 <i class="fas fa-th-large"></i>
149 <?php echo esc_html__('Blocks', 'templateberg'); ?>
150 </a>
151 <?php
152 }
153 ?>
154 </div>
155 <div class="tb-list__actions">
156 <div class="tb-list__sorting">
157 <label for=""><?php echo esc_html__('Sort by', 'templateberg'); ?> :</label>
158 <select name="tb-list__sorting" id="tb-list__sorting_select">
159 <option value="newest" selected><?php echo esc_html__('Newest Items', 'templateberg'); ?></option>
160 <option value="popularity"><?php echo esc_html__('Popular Items', 'templateberg'); ?></option>
161 </select>
162 </div>
163 <!--Added-->
164 <div class="tb-gutenberg-templates-refresh">
165 <span class="dashicon dashicons dashicons-image-rotate"></span>
166 </div>
167 </div>
168 </div>
169 <div class="tb-list__content">
170 <?php
171 if (!empty($current_tab_data)) {
172 foreach ($current_tab_data as $item) {
173 ?>
174 <div aria-label="<?php echo esc_attr($item['title'])?>" class="tb-list__item" data-id="<?php echo esc_attr($item['id'])?>" data-type="<?php echo esc_attr($item['type']);?>">
175 <div class="tb-list__item_preview">
176 <img src="<?php echo esc_url($item['screenshot_url']);?>" loading="lazy">
177 <span class="tb-list__author"><i class="fas fa-user"></i>
178 <?php echo esc_html__('By : ', 'templateberg').esc_html(ucwords($item['author'])); ?>
179 </span>
180 </div>
181 <div class="tb-list__item_footer">
182 <div class="tb-list__item_price">
183 <?php $tb_download_price = (int) $item['price']; ?>
184 <span>
185 <?php
186 if ($tb_download_price > 0) :
187 echo wp_kses_post($item['price_with_symbol']);
188 else :
189 echo esc_html__('Free', 'templateberg');
190 endif;
191 ?>
192 </span>
193 </div>
194 <div class="tb-list__item_meta">
195 <h4>
196 <a class="tb-list__item_title_link" href="<?php echo esc_url($item['permalink'])?>" target="_blank" rel="noopener">
197 <?php echo esc_attr($item['title'])?>
198 </a>
199 </h4>
200 <?php
201 if (isset($item['templates']) && is_array($item['templates']) && count($item['templates'])) {
202 echo '<span class="tb-list__item-tk-count">'.count($item['templates']).' Templates</span>';
203 }
204 ?>
205 </div>
206 <div class="tb-list__item_actions">
207 <a class="tb-item__preview_link" href="<?php echo esc_url($item['demo_url']);?>" target="_blank"><?php echo esc_html__('Preview', 'templateberg'); ?></a>
208 <a class="tb-list__item_btn tb-list__item_buy_btn" data-id="<?php echo esc_attr($item['id'])?>" data-is_pro="<?php echo esc_attr(( $tb_download_price > 0 ) ? 'pro' : 'free'); ?>" href="<?php echo esc_url($item['permalink'])?>" target="_blank" rel="noopener">
209 <?php if ($tb_download_price > 0) :
210 echo esc_html__('Purchase', 'templateberg');
211 else :
212 echo esc_html__('Get It Free', 'templateberg');
213 endif;
214 ?>
215 </a>
216 </div>
217 </div>
218 </div>
219 <?php
220 }
221 }
222 ?>
223 </div>
224 <?php
225 echo templateberg_pagination($paged, $max_pages);
226 ?>
227 </div>
228 </div>
229 <?php
230 require_once TEMPLATEBERG_PATH . 'includes/lists/templates/gutenberg-buy-preview.php';
231 // Scripts.
232 wp_enqueue_script(
233 'templateberg-gutenberg', // Handle.
234 TEMPLATEBERG_URL . 'dist/gutenberg.min.js', // Block.build.js: We register the block here. Built with Webpack.
235 array( 'jquery' ), // Dependencies, defined above.
236 TEMPLATEBERG_VERSION, // Version: File modification time.
237 true // Enqueue the script in the footer.
238 );
239 wp_localize_script(
240 'templateberg-gutenberg',
241 'templateberg_gutenberg',
242 array(
243 'restNonce' => wp_create_nonce('wp_rest'),
244 'restUrl' => esc_url_raw(rest_url()),
245 'currentTab' => $current_tab,
246 'popularList' => $templates_list_popular,
247 'normalList' => $templates_list,
248 'text' => array(
249 'preview' => esc_html__('Preview', 'templateberg'),
250 'purchase' => esc_html__('Purchase', 'templateberg'),
251 'noItem' => esc_html__('No item on selected categories!', 'templateberg'),
252 'allItems' => esc_html__('All Items', 'templateberg'),
253 'by' => esc_html__('By', 'templateberg'),
254 'templates' => esc_html__('Templates', 'templateberg'),
255 ),
256 )
257 );
258 ?>
259 <script type="text/javascript"></script>
260