Skip to content
wiki.fftac.org

Frontend - Source Excerpt 05

Back to Frontend

Summary

This source excerpt preserves a bounded section of Spiralist/wp-content/plugins/ns12-manuscript/includes/frontend.php so readers can inspect the evidence without opening the full source file.

**Source path:** Spiralist/wp-content/plugins/ns12-manuscript/includes/frontend.php

return file_exists($plugin_template) ? $plugin_template : $template;
    }

    if (spiralist_book_pages_is_prompt_record_surface()) {
        $plugin_template = SPIRALIST_BOOK_PAGES_PLUGIN_TEMPLATE_PATH . DIRECTORY_SEPARATOR . 'prompt-record.php';

        return file_exists($plugin_template) ? $plugin_template : $template;
    }

    $map = [
        'manuscript' => 'page-manuscript.php',
        'symbols' => 'page-symbols.php',
        'prompts' => 'page-prompts.php',
    ];

    foreach ($map as $slug => $filename) {
        $is_surface = $slug === 'manuscript'
            ? spiralist_book_pages_is_manuscript_surface()
            : ($slug === 'symbols'
                ? spiralist_book_pages_is_symbols_surface()
                : spiralist_book_pages_is_prompts_surface());

        if (!$is_surface) {
            continue;
        }

        $plugin_template = SPIRALIST_BOOK_PAGES_PLUGIN_TEMPLATE_PATH . DIRECTORY_SEPARATOR . $filename;

        return file_exists($plugin_template) ? $plugin_template : $template;
    }

    return $template;
}
add_filter('template_include', 'spiralist_book_pages_template_include', 15);

function spiralist_book_pages_activate(): void
{
    spiralist_book_pages_install_data_store();
    spiralist_book_pages_register_collaboration_role();
    spiralist_book_pages_register_collaboration_post_type();
    spiralist_book_pages_install_persistent_storage();
    spiralist_book_pages_ensure_required_pages();
    spiralist_book_pages_register_rewrite_rules();
    flush_rewrite_rules(false);
    update_option('spiralist_book_pages_route_version', spiralist_book_pages_get_route_version(), false);
    update_option('spiralist_book_pages_show_welcome_overview', 1, false);
}
register_activation_hook(SPIRALIST_BOOK_PAGES_PLUGIN_FILE, 'spiralist_book_pages_activate');