Jake Vanderwerf
2025-12-23 76d68c97f572120dc75d0501cc82acf4022d6b33
alegacy.php
@@ -53,6 +53,13 @@
const AJV_DIR = WP_PLUGIN_DIR . '/alegacy';
define('AJV_URL', plugin_dir_url(__FILE__));
add_filter('jvbChildDir', function() {
    return AJV_DIR;
});
add_filter('jvbChildUrl', function() {
    return AJV_URL;
});
require(AJV_DIR . '/content/_setup.php');
require(AJV_DIR . '/dashboard/_setup.php');
require(AJV_DIR . '/email/_setup.php');
@@ -60,6 +67,7 @@
require(AJV_DIR . '/login/_setup.php');
require(AJV_DIR . '/taxonomies/_setup.php');
require(AJV_DIR . '/users/_setup.php');
require(AJV_DIR . '/seo.php');
//require(AJV_DIR . '/files/fileManagement.php');
@@ -84,7 +92,7 @@
{
    return [
        'icons'               => 'light',
        'is_directory'        => true,        //as in, a membership directory
        'is_directory'        => false,        //as in, a membership directory
        'has_membership'      => false,
        'has_map'             => true,
        'dashboard'           => true,
@@ -92,7 +100,7 @@
        'magicLink'           => true,
        'support'         => false,
        'feed_block'      => true,
        'email_notifications' => false,
        'email_notifications' => true,
        'integrations'  => [
            'bluesky'     => true,
            'cloudflare'  => true,
@@ -149,7 +157,7 @@
add_filter('jvbAboveHeader', 'altr_legacy_header');
function altr_legacy_header(string $header):string
{
    return '<p><b>WED - SUN</b> <span class="hide-small">&emsp;</span>10<span class="hide-small">:00</span>AM - 6<span class="hide-small">:00</span>PM</p><p>By Appointment<span class="hide-small"> Only</span></p>';
    return '<p><b>WED - SUN</b> <span class="hide-small">&emsp;</span>11<span class="hide-small">:00</span>AM - 6<span class="hide-small">:00</span>PM</p><p>By Appointment<span class="hide-small"> Only</span></p>';
}
@@ -205,8 +213,8 @@
    return $nav;
}
add_filter('jvbBeforeFooter', 'alyns_acknowledgement');
function alyns_acknowledgement():string
add_filter('jvbBeforeFooter', 'altr_acknowledgement');
function altr_acknowledgement():string
{
    return '<p>amiskwacîwâskahikan ᐊᒥᐢᑲᐧᒋᐋᐧᐢᑲᐦᐃᑲᐣ</p><p><a href="https://www.treatysix.org/#comp-lkljqlw1" title="Learn More">Treaty 6 territory</a></p><p>Edmonton, Alberta, Canada</p>';
@@ -243,7 +251,7 @@
    }
    $excerpt = $post->post_excerpt;
    $before = is_singular() ? '<span class="tldr" title="Too Long, Didn\'t Read">TLDR:</span>' : '';
    $before = is_singular() ? '<span class="tldr" title="Too Long, Didn\'t Read" data-short="TLDR:" data-long="TOO LONG, DIDN\'T READ:">TLDR:</span>' : '';
    $excerpt = $before.$excerpt;
    return '<div class="excerpt">'.apply_filters('the_content', $excerpt).'</div>';
}
@@ -251,4 +259,117 @@
add_action( 'init', 'altr_add_excerpts_to_pages' );
function altr_add_excerpts_to_pages() {
    add_post_type_support( 'page', 'excerpt' );
}
add_filter('jvbRegisterCustomIcons', 'altr_custom_icons');
function altr_custom_icons(array $icons):array
{
    $icons['logo-triangle'] = AJV_DIR . '/assets/icons/triangle.svg';
    $icons['logo-triangle-fill'] = AJV_DIR . '/assets/icons/triangle-fill.svg';
    $icons['logo-text'] = AJV_DIR . '/assets/icons/text.svg';
    $icons['logo-text-only'] = AJV_DIR . '/assets/icons/text-only.svg';
    $icons['logo-complete'] = AJV_DIR . '/assets/icons/triangle text back.svg';
    return $icons;
}
add_filter('jvbLoadingIcon', 'altr_loading_icon');
function altr_loading_icon():string
{
    return 'logo-triangle';
}
function altr_render_core_site_logo(array $block, string $content):string
{
    $open = $close = '';
    if (!is_home() && !is_front_page()) {
        $open = '<a href="'.get_home_url().'" rel="home">';
        $close = '</a>';
    }
    return $open.'<span class="logo">'.jvbIcon('logo-triangle').jvbIcon('logo-text-only').'</span>'.$close;
}
add_filter('jvbSummaryHeader', 'altr_progress_summary_header', 10, 2);
function altr_progress_summary_header(string $title, string $type):string
{
    switch ($type) {
        case 'progress':
            return JVB_CONTENT[$type]['plural'];
        default:
            $obj = get_queried_object();
            return '<small>Before & After Laser Tattoo Removal</small><small>'.JVB_TAXONOMY[$type]['singular'].':</small>'.str_replace(JVB_TAXONOMY[$type]['singular'].': ','',$title);
    }
}
add_filter('jvbSummaryHeaderExtra', 'altr_progress_summary_header_extra', 10, 2);
function altr_progress_summary_header_extra(string $title, string $type):string
{
    switch ($type) {
        case 'progress':
            return '<p>See real results of tattoos before and after laser tattoo removal.</p><p>Filter results by number of treatments, age of original tattoo, location on body, fading goal, skin type, timeline between treatments, tattoo style, or tattoo subject matter.</p>';
    }
    return $title;
}
//add_filter('jvbSummaryDetails', 'altr_summary_details', 10, 2);
//function altr_summary_details(array $sections, string $type):array
//{
//    switch ($type) {
//        case 'progress':
//            $sections = [
//                'summary' => '<p>We recommend spacing treatments out at least 12 weeks apart for best results.</p><p>See the difference at Legacy.</p>'
//            ];
//            break;
//    }
//    return $sections;
//}
add_filter('render_block', 'altr_tldr_script', 10, 2);
function altr_tldr_script($content, $block) {
    if ($block['blockName'] === 'core/post-excerpt') {
        add_action('wp_footer', function() {
           ?>
            <script>
            document.addEventListener('DOMContentLoaded', function() {
               const tldrElements = document.querySelectorAll('.tldr');
               tldrElements.forEach(function(el) {
                  let isExpanded = false;
                  el.addEventListener('click', function(e) {
                     e.preventDefault();
                     isExpanded = !isExpanded;
                     window.eraseText(el, 5).then(() => window.typeText(el, isExpanded ? this.dataset.long : this.dataset.short));
                     el.classList.remove('typeText');
                  });
               });
            });
            </script>
            <?php
        },999);
    }
    return $content;
}
add_filter('the_seo_framework_meta_render_data', 'altr_no_next_archive', 10, 1);
function altr_no_next_archive($tags) {
    if (is_post_type_archive(BASE.'progress') || is_post_type_archive(BASE.'terms') || is_post_type_archive(BASE.'faq')) {
        if (array_key_exists('next', $tags)) {
            unset($tags['next']);
        }
    }
    return $tags; // Keep the link for other pages
}
add_filter('jvb_referral_booking_url', 'altr_consult_link');
function altr_consult_link(string $link):string
{
    return 'https://legacytattooremoval.janeapp.com/#/staff_member/2/treatment/15/';
}
add_filter('jvb_referral_estimate_url', 'altr_estimate_link');
function altr_estimate_link(string $link):string
{
    return 'https://legacytattooremoval.ca/get-an-estimate/';
}