# 1. Getting started

## 1.1 What Jikji does

A Jikji document is **HTML plus style rows**. The HTML is a fragment with `j:` attributes for conditions, loops and data bindings; the style rows are the CSS of each element ID and of each class. Saving validates the document and stores it; publishing compiles it:

| What | Where |
|---|---|
| Source HTML | post meta `_jikji_content` |
| Style rows | table `{prefix}jikji_styles` — `{name, type, css}`, `type` `I` (element ID) or `C` (class) |
| Compiled output | `wp-content/jikji/templates/<id>.<version>.php` and `css/<id>.<version>.css`; all classes in `css/common.css`. Versioned files, published by swapping a pointer |

- A **page document** (any post type enabled in the settings, `page` by default) replaces the content area (`the_content`) of the theme's template. The theme's header, footer and layout stay.
- A **template document** (block themes only) replaces the whole page: when WordPress's template hierarchy picks a template that is published with Jikji, Jikji renders it. Template parts and synced patterns are swapped in wherever they render.
- Expressions in `j:` attributes compile to PHP as written, so editing is restricted to the capability `jikji_compile` (administrators by default).

## 1.2 Requirements

| | Requirement |
|---|---|
| WordPress | 6.9 or newer. The AI tab needs 7.0 (the core AI Client) and a connected provider; everything else works on 6.9 |
| PHP | 7.4 or newer |
| Theme | Any theme for page documents. Templates, parts and patterns need a **block theme** (the Site Editor is the entry point) |
| Optional | ACF or Secure Custom Fields for `jikji_field()`; WP-CLI 2.5+ for `wp jikji`; an AI provider plugin and key (Settings → Connectors) for the AI tab |

## 1.3 Installation

1. Install the plugin like any other (upload the folder to `wp-content/plugins/jikji` or activate it from the Plugins screen). Activation creates the style tables and grants `jikji_compile` to administrators (single site) or network super admins (multisite).
2. Open **Appearance → Jikji** (the Plugins screen row also has a **Settings** link). The screen has two tabs; each tab saves on its own and leaves the other tab's values alone.

**General tab**

| Setting | Meaning |
|---|---|
| Post types | Which post types can have a Jikji document. Default: `page`. Templates, parts and patterns do not depend on this list |
| Icon sets | Remixicon (`ri-*`) and Bootstrap Icons (`bi-*`), loaded from a CDN at a version the plugin pins. Only enabled sets can be picked in the Icon block, and the front end loads only the sets a document uses |
| Breakpoints | Tablet 991px, Mobile landscape 767px, Mobile portrait 478px by default. They must strictly decrease; styles store the variable names (`--jikji-bp-tablet` …), so changing a value regenerates the CSS |
| HTML optimization | Remove HTML comments from compiled output (on by default). Applies from the next compile |
| Revisions | How many revisions to keep per document (default 20, 0 = unlimited). The latest published revision is always kept |

**AI tab** — AI editing on/off, the model, "AI may write code and blocks", "AI may fetch external resources", "Apply usage limits" and the recent-turns log. See [The AI tab](07-ai.md).

The old address `admin.php?page=jikji` still opens the same screen.

## 1.4 Who can build

- Opening the builder, every `jikji/v1` REST route that edits, renders or evaluates, and `wp jikji` all require **`jikji_compile`** *and* `edit_post` on the document.
- For templates and parts WordPress maps `edit_post` to `edit_theme_options`, so in practice administrators. A pattern (`wp_block`) needs `edit_post` on that pattern.
- Editors without `jikji_compile` keep editing fields and block content as usual; when a page with a published Jikji document is opened in the block editor, a notice tells everyone that those blocks are not what visitors see. See [Templates 6.9](06-templates.md#69-operators-and-developers) for how to split the work.

## 1.5 Your first page — in the editor

1. Create a page (Pages → Add New) and open its edit screen. Click **Edit with Jikji** in the toolbar.
2. Press **+** (Add block) and add a **Section**; with it selected add a **Heading** and a **Text**. Elements get an ID like `jk-a1b2c3` from the server automatically.
3. Type into the heading on the canvas. In the right panel set padding, a background and a font size — those become the section's and heading's ID styles.
4. **Save**. The page is still a WordPress draft, so nothing is compiled yet.
5. Publish the page from WordPress (or, if it is already published, every save compiles and goes live at once — the toolbar says so).
6. **View site** opens the page. [The editor](02-editor.md) describes every part of the screen.

## 1.6 Your first page — from a shell

```bash
WP="wp --path=/var/www/site"

PAGE=$($WP post create --post_type=page --post_title='Hello Jikji' --porcelain)

cat > hello.html <<'HTML'
<section id="{hero}" class="hello-hero">
  <h1 id="{title}" j:text="jikji_post('title', $post)">Title</h1>
  <p id="{lead}">This page is compiled to PHP by Jikji.</p>
</section>
HTML
echo '[{"name": "{hero}", "type": "I", "css": "padding:80px 24px;text-align:center;"}]' > hello.json

$WP jikji content save "$PAGE" --html=hello.html --styles=hello.json --placeholders
$WP post update "$PAGE" --post_status=publish          # publishing compiles the document
$WP jikji status "$PAGE"
```

- `{hero}` and the other braces are placeholders; `--placeholders` replaces them with server IDs and reports the mapping.
- A save on a draft only stores the document; on a published page every save compiles and is live immediately.
- The whole command set is in [`wp jikji`](09-cli.md); the same through HTTP is in [REST API](10-rest-api.md).

## 1.7 Where to go next

- Building in the browser: [The editor](02-editor.md) → [Blocks](03-blocks.md) → [Styles](04-styles.md).
- Pages that show real data: [Dynamic data](05-dynamic-data.md).
- Headers, footers, archives, single-post layouts: [Templates, parts and patterns](06-templates.md).
- Letting an AI help inside the builder: [The AI tab](07-ai.md).
- Automating: [`wp jikji`](09-cli.md), [REST API](10-rest-api.md), [For AI coding agents](11-agents.md).
