Jalpi has four import paths and three export paths. All of them are JSON β there is no ZIP handling, no XML and no HTML import anywhere in the codebase.
The paths#
| Path | Direction | Endpoint / mechanism | Capability |
|---|---|---|---|
| Template export | Out | GET /templates/{id}/export | edit_posts |
| Template import | In | POST /templates/import β { json, name? } | edit_posts / publish_posts |
| Class export | Out | GET /classes/export β { version, classes } | edit_posts |
| Class import | In | POST /classes/import β { classes, conflict_strategy } | edit_posts |
| Design System export | Out | GET /design-system | manage_options |
| Design System import | In | POST /design-system, or store.dsImportJSON() in the editor | manage_options |
| Website kit import | In | POST /import-website β { website_id } | manage_options |
| Bundled template seed | In | POST /templates/seed-bundled β { force } | edit_posts |
Templates#
Import takes a JSON string, not an object:
await apiFetch(`${base}/templates/import`, {
method: 'POST',
body: JSON.stringify({ json: fileContentsAsString, name: 'My Template' }),
});sanitize_template_data() routes by declared type: a page payload through Jalpi_Sanitizer::sanitize_page_data(), a section or element payload through sanitize_node(). A payload whose type is unknown, or whose nodes are all rejected, produces an empty template rather than an error.
Classes#
Class import takes an array of JalpiClass objects plus a conflict strategy:
| Strategy | On a name collision |
|---|---|
skip (default) | Leave the existing class untouched |
overwrite | Replace the existing classβs definition |
duplicate | Create a new class with a -2, -3β¦ suffixed name |
The response is { created, updated, skipped }. Every imported definition passes through Jalpi_Sanitizer::sanitize_class_definition(), and each write bumps the class version so page render caches are invalidated.
Website kits#
Kit import reads a file that is already inside the plugin directory β nothing is uploaded. The id is sanitize_key()ed and explicitly checked for / and \ before the path is built.
To ship your own kit, drop a JSON file into websites/. Jalpi_Kit_Templates::load_kits() picks up any *.json there that has both an id and a pages array, so it appears in the Template Library immediately, and import_website() can install it.
Use the current page shape β { title, slug, is_front, canvas_data } β rather than the older { id, slug, name } shape still used by itservices.json, or every imported page will be titled βPageβ.
Assets#
Image handling differs by path:
- Templates and classes β image URLs are stored as strings and exported as strings. Nothing is copied. A template moved between sites keeps pointing at the original siteβs media.
- Website kits β kit JSON references images by URL. WooCommerce product images are the exception:
Jalpi_Woo::sideload_image()pulls them into the media library during a product seed. - Editor uploads β
POST /media/uploadsniffs the real MIME withfinfoand accepts only JPEG, PNG, GIF, WebP and AVIF.
Important
- Exported templates and classes contain image URLs, not images. Importing into a different site produces working layout with broken image references unless you migrate the media separately.
Source
Files
includes/class-jalpi-templates.php includes/class-jalpi-classes-api.php includes/class-jalpi-api.php includes/class-jalpi-class-manager.php includes/class-jalpi-woo.php
Classes
Jalpi_Templates Jalpi_Classes_API Jalpi_Class_Manager Jalpi_API Jalpi_Woo
Functions
export_template import_template sanitize_template_data export_all import import_website sideload_image
Last updated: November 2026