PluginProbe
BlockSpare – Gutenberg Blocks, AI Content Generator & Site Builder for News, Magazine & Blogs / 5.0.1
BlockSpare – Gutenberg Blocks, AI Content Generator & Site Builder for News, Magazine & Blogs v5.0.1
5.0.1 4.1.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 2.1.2 2.5.0 2.5.3 All 39 releases
← All changes | inc/init.php +37 -4 4.1.0 → 5.0.1 View file →
@@ -46,13 +46,21 @@
46 46
47 47
48 48 $args = ['public' => true, 'show_in_rest' => true];
49 49 $post_types = get_post_types($args, 'objects');
50 + $excluded_post_types = [
51 + 'attachment',
52 + 'bs_templates',
53 + ];
54 + $output = [];
50 55
51 - $output = [];
56 +
52 57 foreach ($post_types as $post_type) {
53 - if ($post_type->name === 'attachment') continue;
54 58
59 + if (in_array($post_type->name, $excluded_post_types, true)) {
60 + continue;
61 + }
62 +
55 63 $output[] = [
56 64 'value' => $post_type->name,
57 65 'label' => $post_type->label,
58 66 ];
@@ -314,10 +322,15 @@
314 322 $open_design = isset($_GET['blockspare_show_intro']) && $_GET['blockspare_show_intro'] === 'true';
315 323 $blockData = '';
316 324
317 325 if (isset($_GET['blockspare_create_block'])) {
326 +
318 327 $blockName = sanitize_text_field($_GET['blockspare_create_block']);
328 + $blockTitle = sanitize_text_field($_GET['post_title']);
329 +
330 + // Get from template library filter
319 331 $filterdata = apply_filters('blockspare_template_library', []);
332 +
320 333 foreach ($filterdata as $block) {
321 334 if (isset($block['key']) && $block['key'] === $blockName) {
322 335 $blockData = $block['content'];
323 336 break;
@@ -322,8 +335,23 @@
322 335 $blockData = $block['content'];
323 336 break;
324 337 }
325 338 }
339 +
340 + // Get from bs_templates post type if not found
341 + if (empty($blockData) && ! empty($blockTitle)) {
342 +
343 + $templates = get_posts([
344 + 'post_type' => 'bs_templates',
345 + 'post_status' => 'publish',
346 + 'title' => $blockTitle,
347 + 'posts_per_page' => 1,
348 + ]);
349 +
350 + if (! empty($templates)) {
351 + $blockData = $templates[0]->post_content;
352 + }
353 + }
326 354 }
327 355
328 356 $blockspare_current_wp_version = get_bloginfo('version');
329 357 $loadscripton = (isset($GLOBALS['pagenow']) && $GLOBALS['pagenow'] === 'widgets.php') || is_customize_preview();
@@ -355,10 +383,15 @@
355 383 'wpversion' => (version_compare($blockspare_current_wp_version, '6.6') >= 0) ? 'true' : 'false',
356 384 'inspector_imgs' => BLOCKSPARE_PLUGIN_URL . 'assets/images',
357 385 'upgradeUrl' => 'https://afthemes.com/blockspare-pro/',
358 386 'isPro' => false,
387 + 'allowedFonts' => $this->blockspare_allow_fonts()
359 388 ];
360 389 }
390 + public function blockspare_allow_fonts()
391 + {
392 + return ['ABeeZee', 'Abel', 'Lato', 'Oswald'];
393 + }
361 394
362 395 public function blockspare_fb_enqueue_frontend_assets()
363 396 {
364 397 wp_enqueue_style(
@@ -395,14 +428,14 @@
395 428 {
396 429 $custom = [
397 430 [
398 431 'slug' => 'blockspare-post',
399 - 'title' => __('News and Magazine', 'blockspare'),
432 + 'title' => __('Editorial & Content', 'blockspare'),
400 433
401 434 ],
402 435 [
403 436 'slug' => 'blockspare',
404 - 'title' => __('Business', 'blockspare'),
437 + 'title' => __('Business & Layout', 'blockspare'),
405 438
406 439 ],
407 440
408 441 ];