Appearance
Architecture Overview
This document provides a high-level overview of the LamaPress architecture, explaining how the different parts of the system work together.
Table of Contents
Overview
LamaPress is a component-based WordPress theme boilerplate that emphasizes:
- Modularity: Components are self-contained and reusable
- Separation of Concerns: PHP, JavaScript, and SCSS are organized by component
- Developer Experience: Helper functions simplify common tasks
- Performance: Optimized build process and code splitting
- Maintainability: Clear structure and consistent patterns
System Architecture
Component-Based Structure
LamaPress organizes UI into three component types:
- Sections (
components/sections/) - Full-width page sections - Blocks (
components/blocks/) - Reusable UI components - Parts (
components/parts/) - Atomic components (buttons, icons, etc.)
Each component can contain:
index.php- Template file (required)acf.php- ACF field definitions (required for sections, optional for blocks/parts)index.js- JavaScript class (optional)style.scss- Component-specific styles (optional)functions.php- Section-specific functions (optional, sections only)
Data Flow
ACF Fields → Templates → Sections → Blocks → Parts- ACF Fields are defined in component
acf.phpfiles - Templates (
components/templates/) load sections usingllSection() - Sections load blocks using
llBlock()and parts usingllPart() - Blocks and Parts receive data as props
Template System
Templates (components/templates/) are page-level files that:
- Use
llStartTemplate()to begin output buffering - Load sections with
llSection(name, key) - Use
llEndTemplate()to wrap content in layout block
See Templates System for details.
Directory Structure
Components
components/
├── sections/ # Full-width page sections
├── blocks/ # Reusable UI components
├── parts/ # Atomic components
└── templates/ # Page templatesFunctions
functions/
├── includes.php # Core helper functions
├── register-section-fields.php # ACF field registration
├── post-types.php # Custom post type registration
├── taxonomies.php # Custom taxonomy registration
└── ... # Other function filesConfiguration
config/
├── post-types.php # Post type definitions
├── taxonomies.php # Taxonomy definitions
├── post-templates.php # Template mappings
├── fields/ # Global ACF fields
└── ... # Other configuration filesSource Files
src/
├── js/ # JavaScript source files
│ ├── core/ # Core system files
│ ├── components/ # Component JavaScript
│ └── scripts.js # Main entry point
└── scss/ # SCSS source files
├── base/ # Base styles
├── sections/ # Section styles
└── styles.scss # Main entry pointCore Concepts
Sections, Blocks, and Parts
- Sections: Full-width page components (e.g., hero, content sections)
- Blocks: Reusable UI components (e.g., rich content, image slider)
- Parts: Atomic components (e.g., buttons, icons, images)
See Component System for details.
ACF Integration
ACF fields are automatically registered from component acf.php files:
- Section fields are grouped by template
- Block/part fields can be reused via
llGetFields() - Fields are accessed using
llField(),llFields(), orllGetFields()
See ACF Integration for details.
JavaScript Architecture
JavaScript components are automatically loaded via data-component attributes:
- Components export default classes
- Lifecycle methods:
constructor(),init(),bindEvents(),enter(),destroy() - Core instances provide shared functionality (Router, Scroller, Device, etc.)
See JavaScript Architecture for details.
Styling System
LamaPress uses Tailwind CSS with custom design system:
- Typography system (
ll-{category}-{size}classes) - Color system (theme-based CSS variables)
- Grid system (
ll-gridclass with column utilities) - Spacing system (responsive spacing utilities)
See Styling System for details.
Request Lifecycle
WordPress Initialization
- WordPress core loads
- Theme functions are loaded
- ACF fields are registered from component files
Template Selection
- WordPress selects template based on page type
- Template file (
components/templates/*.php) is loaded
Template Execution
llStartTemplate()begins output buffering- Sections are loaded with
llSection(name, key) - ACF fields are retrieved for each section
llEndTemplate()wraps content in layout block
Component Rendering
- Section templates render HTML
- Blocks and parts are loaded with
llBlock()andllPart() - Data flows from sections to blocks to parts
JavaScript Initialization
- Vite injects JavaScript bundle
Appclass initializes core instances- Components with
data-componentattributes are automatically loaded - Page transitions are set up (Swup)
Component Lifecycle
- Components call
init()for setup bindEvents()attaches event listenersenter()triggers reveal animationsdestroy()cleans up on page transitions
- Components call
Related Documentation
- Component System - Component structure and usage
- JavaScript Architecture - JavaScript system details
- ACF Integration - ACF field system
- Templates System - Template hierarchy
- PHP Functions Reference - Helper functions
- Styling System - Styling approach
Next Steps:
- Read Component System to understand component structure
- Review JavaScript Architecture for JavaScript details
- Check Templates System for template usage