| 1 |
<?php |
| 2 |
$paged = get_query_var('paged')?get_query_var('paged'):1; |
| 3 |
$themes_list = templateberg_get_theme_templates($paged); |
| 4 |
$themes_list_popular = get_transient('templateberg_tt_p_'.$paged); |
| 5 |
$total_themes = get_transient('templateberg_tt_total'); |
| 6 |
$max_pages = get_transient('templateberg_tt_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()->setup_themes($themes_list); |
| 19 |
$data = templateberg_template_lists_data()->data; |
| 20 |
|
| 21 |
$current_theme = get_stylesheet(); |
| 22 |
?> |
| 23 |
|
| 24 |
<link rel="stylesheet" id="templateberg-dashboard-shortcode-css" href="<?php echo TEMPLATEBERG_URL . 'dist/list.css' ?>" type="text/css" media="all"> |
| 25 |
|
| 26 |
<div class="tb-list__template" role="document"> |
| 27 |
<div class="tb-list__sidebar"> |
| 28 |
<div class="tb-list__search"> |
| 29 |
<input class="tb-list__searchinput" type="text" id="" placeholder="Search" value=""> |
| 30 |
<i class="fas fa-search" tabindex="-1"></i> |
| 31 |
</div> |
| 32 |
<div class="tb-list__categories"><h3><?php echo esc_html__('Categories', 'templateberg'); ?></h3> |
| 33 |
<div class="tb-list__categories-filter-wrap"> |
| 34 |
<ul class="tb-list__categories-wrap-tab"> |
| 35 |
<li class="tb-list__categories-tab-item tb-filter-active" data-id="all"><?php echo esc_html__('All', 'templateberg'); ?></li> |
| 36 |
<li class="tb-list__categories-tab-item" data-id="free"><?php echo esc_html__('Free', 'templateberg'); ?></li> |
| 37 |
<li class="tb-list__categories-tab-item" data-id="pro"><?php echo esc_html__('Pro', 'templateberg'); ?></li> |
| 38 |
</ul> |
| 39 |
</div> |
| 40 |
<ul class="tb-list__cat_lists tb-cat-lists-all tb-cats-content-active"> |
| 41 |
<?php |
| 42 |
$current_tab_cats = array(); |
| 43 |
$count_items = templateberg_template_lists_data()->countItems; |
| 44 |
if (isset($count_items['all'])) { |
| 45 |
$current_tab_cats =$count_items['all']; |
| 46 |
} |
| 47 |
if (!empty($current_tab_cats)) { |
| 48 |
foreach ($current_tab_cats as $cat => $count) { |
| 49 |
if ($cat === 'all') { |
| 50 |
?> |
| 51 |
<li class="tb-list__current_item"> |
| 52 |
<a href="#" data-cat="<?php echo esc_attr($cat);?>"> |
| 53 |
<?php echo esc_html__('All Items', 'templateberg'); ?> |
| 54 |
<span><?php echo $count;?></span> |
| 55 |
</a> |
| 56 |
</li> |
| 57 |
<?php |
| 58 |
} else { |
| 59 |
?> |
| 60 |
<li class=""> |
| 61 |
<a href="#" data-cat="<?php echo esc_attr($cat);?>"> |
| 62 |
<?php echo esc_html(ucwords(str_replace("-", " ", $cat)));?> |
| 63 |
<span><?php echo $count;?></span> |
| 64 |
</a> |
| 65 |
</li> |
| 66 |
<?php |
| 67 |
} |
| 68 |
} |
| 69 |
} |
| 70 |
?> |
| 71 |
</ul> |
| 72 |
<ul class="tb-list__cat_lists tb-cat-lists-free"> |
| 73 |
<?php |
| 74 |
$current_tab_cats = array(); |
| 75 |
$count_items = templateberg_template_lists_data()->countFreeItems; |
| 76 |
if (isset($count_items['all'])) { |
| 77 |
$current_tab_cats =$count_items['all']; |
| 78 |
} |
| 79 |
if (!empty($current_tab_cats)) { |
| 80 |
foreach ($current_tab_cats as $cat => $count) { |
| 81 |
if ($cat === 'all-free') { |
| 82 |
?> |
| 83 |
<li class="tb-list__current_item"> |
| 84 |
<a href="#" data-cat="<?php echo esc_attr($cat);?>"> |
| 85 |
<?php echo esc_html__('All Items', 'templateberg'); ?> |
| 86 |
<span><?php echo $count;?></span> |
| 87 |
</a> |
| 88 |
</li> |
| 89 |
<?php |
| 90 |
} else { |
| 91 |
?> |
| 92 |
<li class=""> |
| 93 |
<a href="#" data-cat="<?php echo esc_attr($cat);?>"> |
| 94 |
<?php echo esc_html(ucwords(str_replace("-", " ", $cat)));?> |
| 95 |
<span><?php echo $count;?></span> |
| 96 |
</a> |
| 97 |
</li> |
| 98 |
<?php |
| 99 |
} |
| 100 |
} |
| 101 |
} |
| 102 |
?> |
| 103 |
</ul> |
| 104 |
<ul class="tb-list__cat_lists tb-cat-lists-pro"> |
| 105 |
<?php |
| 106 |
$current_tab_cats = array(); |
| 107 |
$count_items = templateberg_template_lists_data()->countProItems; |
| 108 |
if (isset($count_items['all'])) { |
| 109 |
$current_tab_cats =$count_items['all']; |
| 110 |
} |
| 111 |
if (!empty($current_tab_cats)) { |
| 112 |
foreach ($current_tab_cats as $cat => $count) { |
| 113 |
if ($cat === 'all-pro') { |
| 114 |
?> |
| 115 |
<li class="tb-list__current_item"> |
| 116 |
<a href="#" data-cat="<?php echo esc_attr($cat);?>"> |
| 117 |
<?php echo esc_html__('All Items', 'templateberg'); ?> |
| 118 |
<span><?php echo $count;?></span> |
| 119 |
</a> |
| 120 |
</li> |
| 121 |
<?php |
| 122 |
} else { |
| 123 |
?> |
| 124 |
<li class=""> |
| 125 |
<a href="#" data-cat="<?php echo esc_attr($cat);?>"> |
| 126 |
<?php echo esc_html(ucwords(str_replace("-", " ", $cat)));?> |
| 127 |
<span><?php echo $count;?></span> |
| 128 |
</a> |
| 129 |
</li> |
| 130 |
<?php |
| 131 |
} |
| 132 |
} |
| 133 |
} |
| 134 |
?> |
| 135 |
</ul> |
| 136 |
</div> |
| 137 |
</div> |
| 138 |
<div class="tb-list__container"> |
| 139 |
<div> |
| 140 |
<span class="tb-list__btn"><i class="fas fa-bars"></i></span> |
| 141 |
</div> |
| 142 |
<div class="tb-list__header"> |
| 143 |
<div class="tb-list__links"> |
| 144 |
<a href="#" class="tb-list__cat_btn is-selected" data-type="all"> |
| 145 |
<i class="fas fa-images"></i> |
| 146 |
<?php echo esc_html__('All', 'templateberg'); ?> |
| 147 |
</a> |
| 148 |
<?php |
| 149 |
$current_tab_data = $data['all']; |
| 150 |
if (isset($data['normal'])) { |
| 151 |
?> |
| 152 |
<a href="#" class="tb-list__cat_btn" data-type="normal"> |
| 153 |
<i class="fas fa-images"></i> |
| 154 |
<?php echo esc_html__('Normal', 'templateberg'); ?> |
| 155 |
</a> |
| 156 |
<?php |
| 157 |
} |
| 158 |
if (isset($data['gutenberg'])) { |
| 159 |
?> |
| 160 |
<a href="#" class="tb-list__cat_btn" data-type="gutenberg"> |
| 161 |
<i class="far fa-file"></i> |
| 162 |
<?php echo esc_html__('Gutenberg', 'templateberg'); ?> |
| 163 |
</a> |
| 164 |
<?php |
| 165 |
} |
| 166 |
if (isset($data['full-site-editing'])) { |
| 167 |
?> |
| 168 |
<a href="#" class="tb-list__cat_btn" data-type="full-site-editing"> |
| 169 |
<i class="fas fa-th-large"></i> |
| 170 |
<?php echo esc_html__('Full Site Editing', 'templateberg'); ?> |
| 171 |
</a> |
| 172 |
<?php |
| 173 |
} |
| 174 |
if (isset($data['elementor'])) { |
| 175 |
?> |
| 176 |
<a href="#" class="tb-list__cat_btn" data-type="elementor"> |
| 177 |
<i class="fas fa-th-large"></i> |
| 178 |
<?php echo esc_html__('Elementor', 'templateberg'); ?> |
| 179 |
</a> |
| 180 |
<?php |
| 181 |
} |
| 182 |
?> |
| 183 |
</div> |
| 184 |
<div class="tb-list__actions"> |
| 185 |
<div class="tb-list__sorting"> |
| 186 |
<label for=""><?php echo esc_html__('Sort by', 'templateberg'); ?> :</label> |
| 187 |
<select name="tb-list__sorting" id="tb-list__sorting_select"> |
| 188 |
<option value="newest" selected><?php echo esc_html__('Newest Items', 'templateberg'); ?></option> |
| 189 |
<option value="popularity"><?php echo esc_html__('Popular Items', 'templateberg'); ?></option> |
| 190 |
</select> |
| 191 |
</div> |
| 192 |
<!--Added--> |
| 193 |
<div class="tb-themes-template-kits-refresh"> |
| 194 |
<span class="dashicon dashicons dashicons-image-rotate"></span> |
| 195 |
</div> |
| 196 |
</div> |
| 197 |
</div> |
| 198 |
<div class="tb-list__content"> |
| 199 |
<?php |
| 200 |
if (!empty($current_tab_data)) { |
| 201 |
foreach ($current_tab_data as $item) { |
| 202 |
?> |
| 203 |
<div aria-label="<?php echo esc_attr($item['title'])?>" |
| 204 |
class="tb-list__item <?php echo isset($item['theme']) && $item['theme']['slug'] === $current_theme?'tb-list__active_theme':''?>" |
| 205 |
data-id="<?php echo esc_attr($item['id'])?>" |
| 206 |
data-type="<?php echo esc_attr($item['type']);?>" |
| 207 |
> |
| 208 |
<div class="tb-list__item_preview"> |
| 209 |
<img src="<?php echo esc_url($item['screenshot_url']);?>" loading="lazy"> |
| 210 |
<span class="tb-list__author"> |
| 211 |
<i class="fas fa-user"></i> |
| 212 |
<?php |
| 213 |
echo esc_html__('By : ', 'templateberg'). esc_html(ucwords($item['author'])); |
| 214 |
?> |
| 215 |
</span> |
| 216 |
</div> |
| 217 |
<div class="tb-list__item_footer"> |
| 218 |
<div class="tb-list__item_price"> |
| 219 |
<?php $tb_download_price = (int) $item['price']; ?> |
| 220 |
<span> |
| 221 |
<?php |
| 222 |
if ($tb_download_price > 0) : |
| 223 |
echo wp_kses_post($item['price_with_symbol']); |
| 224 |
else : |
| 225 |
echo esc_html__('Free', 'templateberg'); |
| 226 |
endif; |
| 227 |
?> |
| 228 |
</span> |
| 229 |
</div> |
| 230 |
<div class="tb-list__item_meta"> |
| 231 |
<h4> |
| 232 |
<a class="tb-list__item_title_link" href="<?php echo esc_url($item['permalink'])?>" target="_blank" rel="noopener"> |
| 233 |
<?php echo esc_attr($item['title'])?> |
| 234 |
</a> |
| 235 |
</h4> |
| 236 |
<?php |
| 237 |
if (isset($item['theme'])) { |
| 238 |
?> |
| 239 |
<span class="tb-list__item-theme"> |
| 240 |
<?php |
| 241 |
if( isset($item['theme']) && $item['theme']['slug'] === $current_theme){ |
| 242 |
?> |
| 243 |
<span class="tb-list__item-theme--link" data-theme_slug="<?php echo esc_attr($item['theme']['slug'])?>" ><span class="dashicons dashicons-saved"></span><?php echo esc_attr($item['theme']['name'])?></span> |
| 244 |
<?php |
| 245 |
} |
| 246 |
else{ |
| 247 |
?> |
| 248 |
<a class="tb-list__item-theme--link" href="<?php echo esc_url($item['theme']['permalink'])?>" data-theme_slug="<?php echo esc_attr($item['theme']['slug'])?>" target="_blank"><span class="dashicons dashicons-plus-alt2"></span><?php echo esc_attr($item['theme']['name'])?></a> |
| 249 |
<?php |
| 250 |
} |
| 251 |
?> |
| 252 |
</span> |
| 253 |
<?php |
| 254 |
} |
| 255 |
?> |
| 256 |
</div> |
| 257 |
<div class="tb-list__item_actions"> |
| 258 |
<a class="tb-item__preview_link" href="<?php echo esc_url($item['demo_url']);?>" target="_blank"><?php echo esc_html__('Preview', 'templateberg'); ?></a> |
| 259 |
<a class="tb-list__item_btn tb-list__item_buy_btn" |
| 260 |
data-id="<?php echo esc_attr($item['id'])?>" |
| 261 |
data-is_pro="<?php echo esc_attr(( $tb_download_price > 0 ) ? 'pro' : 'free'); ?>" |
| 262 |
data-theme_name="<?php echo esc_attr($item['theme']['name'])?>" |
| 263 |
data-theme_slug="<?php echo esc_attr($item['theme']['slug'])?>" |
| 264 |
href="<?php echo esc_url($item['permalink'])?>" |
| 265 |
target="_blank" |
| 266 |
rel="noopener" |
| 267 |
> |
| 268 |
<?php if ($tb_download_price > 0) : |
| 269 |
echo esc_html__('Purchase', 'templateberg'); |
| 270 |
else : |
| 271 |
echo esc_html__('Get It Free', 'templateberg'); |
| 272 |
endif; |
| 273 |
?> |
| 274 |
</a> |
| 275 |
</div> |
| 276 |
</div> |
| 277 |
</div> |
| 278 |
<?php |
| 279 |
} |
| 280 |
} |
| 281 |
?> |
| 282 |
</div> |
| 283 |
<?php |
| 284 |
echo templateberg_pagination($paged, $max_pages); |
| 285 |
?> |
| 286 |
</div> |
| 287 |
</div> |
| 288 |
<?php |
| 289 |
require_once TEMPLATEBERG_PATH . 'includes/lists/templates/theme-buy-preview.php'; |
| 290 |
// Scripts. |
| 291 |
wp_enqueue_script( |
| 292 |
'templateberg-all-theme', // Handle. |
| 293 |
TEMPLATEBERG_URL . 'dist/theme.min.js', // Block.build.js: We register the block here. Built with Webpack. |
| 294 |
array( 'jquery' ), // Dependencies, defined above. |
| 295 |
TEMPLATEBERG_VERSION, // Version: File modification time. |
| 296 |
true // Enqueue the script in the footer. |
| 297 |
); |
| 298 |
wp_localize_script( |
| 299 |
'templateberg-all-theme', |
| 300 |
'templateberg_all_theme', |
| 301 |
array( |
| 302 |
'restNonce' => wp_create_nonce('wp_rest'), |
| 303 |
'restUrl' => esc_url_raw(rest_url()), |
| 304 |
'popularThemes' => $themes_list_popular, |
| 305 |
'allThemes' => $themes_list, |
| 306 |
'currentTheme' => $current_theme, |
| 307 |
'text' => array( |
| 308 |
'import' => esc_html__('Import', 'templateberg'), |
| 309 |
'purchase' => esc_html__('Purchase', 'templateberg'), |
| 310 |
'free' => esc_html__('Get It Free', 'templateberg'), |
| 311 |
'allItems' => esc_html__('All Items', 'templateberg'), |
| 312 |
'by' => esc_html__('By', 'templateberg'), |
| 313 |
'templates' => esc_html__('Templates', 'templateberg'), |
| 314 |
), |
| 315 |
) |
| 316 |
); |
| 317 |
|
| 318 |
|