Jake Vanderwerf
2026-01-04 afdc1b396e3e88146006cd707a15b9da4843e1c2
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
<?php
 
use JVBase\utility\Features;
 
if (!defined('ABSPATH')) {
    exit;
}
//Blocks
if (Features::forSite()->has('feed_block')) {
    require(JVB_DIR . '/build/feed/render.php');
}
require(JVB_DIR . '/build/list/render.php');
require(JVB_DIR . '/build/summary/render.php');
require(JVB_DIR . '/build/forms/render.php');
require(JVB_DIR . '/build/menu/render.php');
if (Features::anyContentHas('is_glossary')) {
    error_log('Has Glossary Type');
    require(JVB_DIR . '/build/glossary/render.php');
}
if (Features::forSite()->has('faq') || array_key_exists('faq', JVB_CONTENT)) {
    require(JVB_DIR . '/build/faq/render.php');
}
if (Features::hasIntegration('gmb')) {
    require(JVB_DIR . '/build/gmbreviews/render.php');
}
 
 
function jvbRegisterBlocks():void
{
    if (Features::hasIntegration('gmb')) {
        register_block_type(JVB_DIR . '/build/gmb-reviews');
    }
//    if (jvbSiteUsesFeedBlock()) {
//        register_block_type(
//            JVB_DIR . '/build/feed',
//            [
//                'render_callback'   => 'jvbRenderFeedBlock'
//            ]
//        );
//    }
    if (Features::anyContentHas('show_directory') || Features::anyTaxonomyHas('show_directory')) {
        register_block_type(
            JVB_DIR . '/build/list',
            [
                'render_callback'   => 'jvbRenderListBlock'
            ]
        );
    }
}
add_action('init', 'jvbRegisterBlocks');
 
function jvbRegisterBlockCategory(array $categories):array
{
    return array_merge($categories, [
        [
            'slug' => 'jvb',
            'title' => get_bloginfo('name'),
            'icon' => 'art'
        ]
    ]);
}
add_filter('block_categories_all', 'jvbRegisterBlockCategory');
 
 
/**
 * Enqueue block editor assets
 */
function jvbEnqueueBlockEditorAssets():void
{
    // Only localize for block editor
    if (!is_admin()) {
        return;
    }
    // Localize list types for the block
    wp_localize_script(
        'jvb-list-editor-script', // This should match your editor script handle
        'jvbListTypes',
        jvbGlobalDirectoryInfo()
    );
}
add_action('enqueue_block_editor_assets', 'jvbEnqueueBlockEditorAssets');