Directory Structure

Below is the top-level layout of the plugin directory. This is a concise map of where major systems live.

sanil-website-builder/
├── sanil-website-builder.php       Plugin entry point
├── CONSTANTS.php                   Plugin-wide constants (SANILWB_PATH, SANILWB_URL, etc.)
│
├── admin/
│   ├── class-sanil-website-builder-admin.php   Main admin orchestrator
│   ├── class-sanilwb-admin-page-builder.php
│   ├── class-sanilwb-admin-site-layout.php     Header & Footer asset enqueue + data injection
│   ├── class-sanilwb-admin-template-builder.php
│   ├── class-sanilwb-admin-theme-options.php
│   ├── helpers.php
│   ├── assets/
│   │   ├── css/                    SCSS source + compiled CSS for all admin pages
│   │   └── js/
│   │       └── src/
│   │           ├── page-builder/   React app
│   │           ├── template-builder/ React app
│   │           ├── theme-options/  React app
│   │           ├── site-layout/    React app (SiteLayout.jsx)
│   │           └── shared/         Shared components, hooks, field types
│   └── templates/
│       ├── meta-box-contents.php
│       ├── page-builder/
│       ├── template-builder/
│       ├── site-layout/            PHP mount point for the Header & Footer React app
│       ├── theme-options/
│       ├── partials/
│       └── sidebar-widgets/
│
├── includes/
│   ├── class-sanil-website-builder.php         Main plugin orchestrator
│   ├── class-sanilwb-ajax.php                  AJAX handlers (template CRUD, preset save)
│   ├── class-sanilwb-db.php                    DB model (wp_sanilwb_templates)
│   ├── class-sanilwb-template-compiler.php     Schema JSON → compiled PHP + CSS
│   ├── class-sanilwb-preset-scanner.php        Low-level preset folder scanner
│   ├── class-sanilwb-sl-presets.php            Preset auto-discovery + settings resolution
│   ├── class-sanilwb-sl-renderer.php           Header/footer renderer + preview endpoint
│   ├── class-sanilwb-cpt-site-layout.php       Site Layout CPT registration + assignment meta box
│   ├── class-sanilwb-site-layout-renderer.php  Site Layout CPT rendering bridge
│   ├── class-sanilwb-font-downloader.php
│   ├── class-sanilwb-font-sync.php
│   └── helpers/
│       ├── class-sanilwb-dialog-helper.php
│       ├── class-sanilwb-form-helper.php
│       └── class-sanilwb-title-style-registry.php
│
├── public/
│   ├── class-sanil-website-builder-public.php  Frontend shortcode rendering
│   ├── hooks.php                               Lazy-load, author filter, preview iframe styles
│   ├── helpers.php                             Frontend helper functions (dates, images, authors)
│   ├── imagesize.php                           Custom image sizes
│   ├── css/                                    Frontend CSS (sanilwb-styles.scss → .css)
│   ├── js/                                     Frontend JS
│   └── presets/
│       ├── header/{slug}/                      Header preset folders
│       └── footer/{slug}/                      Footer preset folders
│
├── calendar/                       Nepali calendar utility
├── mkdocs/                         This documentation
└── graphify-out/                   Knowledge graph analysis artifacts

Each preset folder under public/presets/{type}/{slug}/ must contain manifest.json, index.php, and style.scss. header and footer are the only preset types left — see Header & Footer for the full preset authoring guide. Single/page/archive/404/search moved entirely to the Site Layout CPT, a visual Page-Builder-authored alternative; when nothing is assigned there, the theme's own default templates (partials/site-layout-defaults/ in template-for-page-builder) render instead.