Format
This commit is contained in:
@@ -37,7 +37,7 @@ theme.json # Block themes (WP 5.9+) - structured design tokens
|
||||
|
||||
### CSS Variable Mapping
|
||||
|
||||
| WP Pattern | EmDash Variable |
|
||||
| WP Pattern | EmDash Variable |
|
||||
| ---------------- | ------------------ |
|
||||
| Body font family | `--font-body` |
|
||||
| Heading font | `--font-heading` |
|
||||
|
||||
@@ -7,13 +7,13 @@ Implement CMS-driven features: site settings, menus, taxonomies, and widgets.
|
||||
Map WordPress customizer values to EmDash site settings:
|
||||
|
||||
| WP Customizer Setting | EmDash Site Setting |
|
||||
| --------------------- | --------------------- |
|
||||
| Site Title | `title` |
|
||||
| Tagline | `tagline` |
|
||||
| Site Icon | `favicon` |
|
||||
| Custom Logo | `logo` |
|
||||
| Posts per page | `postsPerPage` |
|
||||
| Date format | `dateFormat` |
|
||||
| --------------------- | ------------------- |
|
||||
| Site Title | `title` |
|
||||
| Tagline | `tagline` |
|
||||
| Site Icon | `favicon` |
|
||||
| Custom Logo | `logo` |
|
||||
| Posts per page | `postsPerPage` |
|
||||
| Date format | `dateFormat` |
|
||||
|
||||
```astro
|
||||
---
|
||||
@@ -134,7 +134,7 @@ const sidebar = await getWidgetArea("sidebar");
|
||||
|
||||
Map WP widgets to Astro components:
|
||||
|
||||
| WP Widget | EmDash Component |
|
||||
| WP Widget | EmDash Component |
|
||||
| ---------------- | ------------------- |
|
||||
| Recent Posts | `core:recent-posts` |
|
||||
| Categories | `core:categories` |
|
||||
|
||||
@@ -900,15 +900,15 @@ const { entry: page } = await getEmDashEntry("pages", "about");
|
||||
|
||||
### Key Differences
|
||||
|
||||
| Aspect | Astro Collections | EmDash Collections |
|
||||
| ---------------------- | ------------------------------- | ----------------------------------------------- |
|
||||
| **Config file** | `src/content.config.ts` | `src/live.config.ts` |
|
||||
| **Schema definition** | In config file with Zod | In EmDash admin UI or seed file |
|
||||
| **Data source** | Files, APIs, custom loaders | SQLite database |
|
||||
| Aspect | Astro Collections | EmDash Collections |
|
||||
| ---------------------- | ------------------------------- | ------------------------------------------- |
|
||||
| **Config file** | `src/content.config.ts` | `src/live.config.ts` |
|
||||
| **Schema definition** | In config file with Zod | In EmDash admin UI or seed file |
|
||||
| **Data source** | Files, APIs, custom loaders | SQLite database |
|
||||
| **Query functions** | `getCollection()`, `getEntry()` | `getEmDashCollection()`, `getEmDashEntry()` |
|
||||
| **Content editing** | Edit source files directly | Admin UI or API |
|
||||
| **Type safety** | Generated from schema | Runtime validation |
|
||||
| **Rendering Markdown** | `render()` from `astro:content` | `<PortableText />` component |
|
||||
| **Content editing** | Edit source files directly | Admin UI or API |
|
||||
| **Type safety** | Generated from schema | Runtime validation |
|
||||
| **Rendering Markdown** | `render()` from `astro:content` | `<PortableText />` component |
|
||||
|
||||
### When to Use Which
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
## Template Hierarchy
|
||||
|
||||
| WP Template | Purpose | EmDash Equivalent |
|
||||
| WP Template | Purpose | EmDash Equivalent |
|
||||
| ------------------------- | ----------------------- | ------------------------------------------------------- |
|
||||
| `index.php` | Fallback for everything | `src/pages/index.astro` |
|
||||
| `front-page.php` | Static front page | `src/pages/index.astro` |
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
## Template Parts
|
||||
|
||||
| WP Pattern | EmDash Pattern |
|
||||
| WP Pattern | EmDash Pattern |
|
||||
| ---------------------------------------------------------- | ---------------------------- |
|
||||
| `get_template_part('content', 'post')` | `<PostCard />` component |
|
||||
| `get_template_part('template-parts/header/site-branding')` | `<SiteBranding />` component |
|
||||
@@ -116,10 +116,10 @@ EmDash: Create collection via admin UI or API. The collection will be created du
|
||||
|
||||
### Content Retrieval
|
||||
|
||||
| WP Function | EmDash Equivalent |
|
||||
| WP Function | EmDash Equivalent |
|
||||
| ----------------------------- | ------------------------------------------------- |
|
||||
| `have_posts()` / `the_post()` | `getEmDashCollection()` |
|
||||
| `get_post()` | `getEmDashEntry()` |
|
||||
| `have_posts()` / `the_post()` | `getEmDashCollection()` |
|
||||
| `get_post()` | `getEmDashEntry()` |
|
||||
| `the_title()` | `post.data.title` |
|
||||
| `the_content()` | `<PortableText value={post.data.content} />` |
|
||||
| `the_excerpt()` | `post.data.excerpt` |
|
||||
@@ -132,7 +132,7 @@ EmDash: Create collection via admin UI or API. The collection will be created du
|
||||
|
||||
### Taxonomies
|
||||
|
||||
| WP Function | EmDash Equivalent |
|
||||
| WP Function | EmDash Equivalent |
|
||||
| ---------------------------- | -------------------------------------------------- |
|
||||
| `get_categories()` | `getTaxonomyTerms("categories")` |
|
||||
| `get_tags()` | `getTaxonomyTerms("tags")` |
|
||||
@@ -149,7 +149,7 @@ EmDash supports hierarchical taxonomies (like categories) and flat taxonomies (l
|
||||
|
||||
### Site Info
|
||||
|
||||
| WP Function | EmDash Equivalent |
|
||||
| WP Function | EmDash Equivalent |
|
||||
| ------------------------- | --------------------------------------- |
|
||||
| `bloginfo('name')` | `getSiteSetting("title")` |
|
||||
| `bloginfo('description')` | `getSiteSetting("tagline")` |
|
||||
@@ -173,7 +173,7 @@ EmDash supports hierarchical taxonomies (like categories) and flat taxonomies (l
|
||||
|
||||
### Media
|
||||
|
||||
| WP Function | EmDash Equivalent |
|
||||
| WP Function | EmDash Equivalent |
|
||||
| --------------------------- | -------------------------- |
|
||||
| `wp_get_attachment_image()` | `<img src={media.url} />` |
|
||||
| `wp_get_attachment_url()` | `media.url` |
|
||||
@@ -181,7 +181,7 @@ EmDash supports hierarchical taxonomies (like categories) and flat taxonomies (l
|
||||
|
||||
### Navigation
|
||||
|
||||
| WP Function | EmDash Equivalent |
|
||||
| WP Function | EmDash Equivalent |
|
||||
| ------------------------ | ------------------------------------- |
|
||||
| `wp_nav_menu()` | `getMenu("menu-name")` + render items |
|
||||
| `wp_list_pages()` | Query pages collection or use menu |
|
||||
@@ -198,10 +198,10 @@ WordPress hooks don't have direct equivalents. Most hook functionality becomes:
|
||||
3. **Build-time logic** - In Astro config or components
|
||||
|
||||
| WP Hook | EmDash Approach |
|
||||
| -------------------- | ------------------------------------------ |
|
||||
| `wp_head` | Add to `<head>` in layout |
|
||||
| `wp_footer` | Add before `</body>` in layout |
|
||||
| `the_content` filter | PortableText components |
|
||||
| -------------------- | ---------------------------------------- |
|
||||
| `wp_head` | Add to `<head>` in layout |
|
||||
| `wp_footer` | Add before `</body>` in layout |
|
||||
| `the_content` filter | PortableText components |
|
||||
| `pre_get_posts` | Query filters in `getEmDashCollection()` |
|
||||
| `save_post` | EmDash plugin hook: `content:beforeSave` |
|
||||
|
||||
@@ -280,14 +280,14 @@ sidebar?.widgets.forEach((widget) => {
|
||||
|
||||
### Widget Types
|
||||
|
||||
| WP Widget | EmDash Widget Type | Notes |
|
||||
| WP Widget | EmDash Widget Type | Notes |
|
||||
| ------------ | ------------------------------- | ----------------------------- |
|
||||
| Text/HTML | `content` | Portable Text (rich content) |
|
||||
| Custom Menu | `menu` | References menu by name |
|
||||
| Recent Posts | `component` `core:recent-posts` | Built-in component with props |
|
||||
| Categories | `component` `core:categories` | Built-in component |
|
||||
| Tag Cloud | `component` `core:tag-cloud` | Built-in component |
|
||||
| Search | `<LiveSearch />` component | Use `emdash/ui` LiveSearch |
|
||||
| Search | `<LiveSearch />` component | Use `emdash/ui` LiveSearch |
|
||||
| Archives | `component` `core:archives` | Built-in component |
|
||||
|
||||
### Core Widget Components
|
||||
@@ -358,7 +358,7 @@ const results = query ? await search(query, { limit: 20 }) : { results: [] };
|
||||
|
||||
### Search Features
|
||||
|
||||
| WordPress | EmDash |
|
||||
| WordPress | EmDash |
|
||||
| ---------------------------- | ------------------------------- |
|
||||
| Basic keyword search | FTS5 with Porter stemming |
|
||||
| Search all public post types | Per-collection search enable |
|
||||
|
||||
@@ -104,7 +104,7 @@ Common elements to check:
|
||||
|
||||
### Common Color Mapping
|
||||
|
||||
| WP Pattern | EmDash Variable |
|
||||
| WP Pattern | EmDash Variable |
|
||||
| ---------------- | ------------------- |
|
||||
| Background | `--color-base` |
|
||||
| Text | `--color-contrast` |
|
||||
|
||||
Reference in New Issue
Block a user