Jake Vanderwerf
2025-09-30 2cb91676044ecd0abd9c45b4835abb8b0d042312
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
<?php
 
if (!defined('ABSPATH')) {
    exit;
}
 
function jvbRenderGallery()
{
    ?>
    <dialog class="gallery" aria-modal="true" aria-label="Image Gallery">
        <div class="wrap">
            <button type="button" class="cancel" aria-label="Close Gallery"> <?= jvbIcon('close') ?></button>
            <button class="nav prev row" aria-label="Previous image">
                <?= jvbIcon('prev') ?>
            </button>
 
            <button class="nav next row" aria-label="Next image">
                <?= jvbIcon('next') ?>
            </button>
 
            <div class="content row">
                <img src="" alt="" class="image">
                <details>
                    <summary class="row btw">DETAILS</summary>
                    <div class="item-info"></div>
                </details>
            </div>
 
            <div class="favourite"></div>
            <div class="counter"><span id="gallery-index">1</span> / <span class="total"></span></div>
        </div>
    </dialog>
    <?php
}
 
function jvbRenderImageForm(int $attachmentId) {
    if (!$attachmentId) return '';
 
    $url = wp_get_attachment_image_url($attachmentId, 'medium');
    $title = get_the_title($attachmentId);
    $alt = get_post_meta($attachmentId, '_wp_attachment_image_alt', true);
    $caption = wp_get_attachment_caption($attachmentId);
 
    ob_start();
    ?>
    <div class="upload-item existing" data-attachment-id="<?= $attachmentId ?>">
        <div class="preview">
            <img src="<?= esc_url($url) ?>" alt="<?= esc_attr($alt) ?>">
            <div class="overlay">
                <div class="actions">
                    <button type="button" class="remove" title="Remove">
                        <span class="screen-reader-text">Remove image</span>
                        ×
                    </button>
                </div>
            </div>
        </div>
        <?= jvbImageMeta() ?>
    </div>
    <?php
    return ob_get_clean();
}