Appearance
Migration Guide
This guide helps you migrate existing WordPress themes or projects to LamaPress.
Table of Contents
- Overview
- Pre-Migration Planning
- Migration Steps
- Component Migration
- ACF Migration
- JavaScript Migration
- Styling Migration
- Post-Migration
Overview
Migrating to LamaPress involves:
- Setting up LamaPress structure
- Converting existing components
- Migrating ACF fields
- Converting JavaScript
- Migrating styles
- Testing and validation
Pre-Migration Planning
Assessment
Before migrating, assess:
Current Structure
- How are components organized?
- What ACF field structure exists?
- What JavaScript frameworks are used?
- What styling approach is used?
Dependencies
- Required plugins
- Custom functionality
- Third-party integrations
Content
- Existing ACF fields
- Custom post types
- Taxonomies
Planning
Create a migration plan:
Inventory Components
- List all components to migrate
- Identify reusable vs. one-off
- Plan component structure
Field Mapping
- Map existing ACF fields
- Plan field organization
- Identify reusable fields
Timeline
- Break into phases
- Set milestones
- Plan testing phases
Migration Steps
Step 1: Set Up LamaPress
- Clone LamaPress repository
- Install dependencies (
npm install,composer install) - Set up development environment
- Configure WordPress constants
Step 2: Migrate Structure
- Create component directories
- Set up function files
- Configure ACF
- Set up build system
Step 3: Migrate Components
- Convert templates to LamaPress format
- Migrate ACF fields
- Convert JavaScript
- Migrate styles
Step 4: Test
- Test each component
- Verify ACF fields
- Test JavaScript functionality
- Check styling
Component Migration
Template Conversion
Before (Traditional WordPress):
php
<?php
$title = get_field('title');
$content = get_field('content');
?>
<div class="section">
<h1><?php echo $title; ?></h1>
<div><?php echo $content; ?></div>
</div>After (LamaPress):
php
<?php
/**
* Hero section component.
*/
defined('ABSPATH') || exit;
$section ??= false;
$key ??= false;
$title = llField('title', $key, $section);
$content = llField('content', $key, $section);
?>
<?php llSectionHeader(name: 'hero_basic'); ?>
<?php if ($title): ?>
<h1 class="ll-heading-2xl"><?= esc_html($title) ?></h1>
<?php endif; ?>
<?php if ($content): ?>
<div class="ll-body-lg"><?= wp_kses_post($content) ?></div>
<?php endif; ?>
<?php llSectionFooter(); ?>Key Changes
- File Header - Add DocBlock and security check
- Field Access - Use
llField()instead ofget_field() - Output - Use
<?= ?>shorthand and escape output - Structure - Use
llSectionHeader()andllSectionFooter() - Classes - Use design system classes
ACF Migration
Field Group Conversion
Before (ACF UI):
- Fields created in ACF UI
- Field groups attached to templates
- Manual field management
After (LamaPress):
php
<?php
// components/sections/hero_basic/acf.php
$title = 'Hero Basic';
$name = 'hero_basic';
$category = 'common';
$key = 'a1b2c3d4e5f6'; // Unique 12-char key
$groupFields = [
[
'key' => $name . '_01',
'label' => 'Title',
'name' => 'title',
'type' => 'text',
'instructions' => 'Enter the hero title',
],
[
'key' => $name . '_02',
'label' => 'Content',
'name' => 'content',
'type' => 'wysiwyg',
],
];
?>Field Key Migration
Important: Field keys must be migrated carefully:
Export Existing Fields
- Export ACF field groups as JSON
- Note existing field keys
Map Field Keys
- Create mapping of old to new keys
- Update field references in code
Update Database
- May need to update post meta keys
- Test thoroughly after migration
JavaScript Migration
Component Conversion
Before (jQuery/vanilla JS):
javascript
$(document).ready(function() {
$('.accordion').each(function() {
$(this).find('.accordion-header').click(function() {
$(this).next('.accordion-content').slideToggle();
});
});
});After (LamaPress):
javascript
import { gsap } from 'gsap/all'
import { app } from '@src/js/core/app'
export default class Accordion {
constructor(element) {
this.element = element
this.button = this.element.querySelector('.js-accordion-button')
this.content = this.element.querySelector('.js-accordion-content')
this.isOpen = false
this.init()
}
init = () => {
this.bindEvents()
this.setInitialState()
}
setInitialState = () => {
gsap.set(this.content, { height: 0, overflow: 'hidden' })
}
bindEvents = () => {
this.button.addEventListener('click', this.toggle)
}
toggle = () => {
if (this.isOpen) {
this.close()
} else {
this.open()
}
}
open = () => {
this.isOpen = true
gsap.to(this.content, {
height: 'auto',
duration: 0.4
})
}
close = () => {
this.isOpen = false
gsap.to(this.content, {
height: 0,
duration: 0.4
})
}
destroy = () => {
this.button.removeEventListener('click', this.toggle)
}
}Key Changes
- ES6 Modules - Use import/export
- Class-Based - Convert to component classes
- GSAP - Use GSAP for animations
- Lifecycle - Implement standard methods
- Cleanup - Add
destroy()method
Styling Migration
CSS to Tailwind
Before (Custom CSS):
css
.hero-section {
padding: 60px 20px;
background: #ffffff;
text-align: center;
}
.hero-title {
font-size: 48px;
font-weight: bold;
margin-bottom: 20px;
}After (Tailwind + Design System):
php
<section class="ll-section ll-section--hero">
<div class="ll-container py-12 md:py-16">
<h1 class="ll-heading-2xl mb-5">Title</h1>
</div>
</section>Key Changes
- Utility Classes - Use Tailwind utilities
- Design System - Use design system classes
- Responsive - Use responsive prefixes
- Minimal Custom CSS - Only when Tailwind insufficient
Post-Migration
Testing Checklist
- [ ] All components render correctly
- [ ] ACF fields display and save
- [ ] JavaScript functionality works
- [ ] Styles apply correctly
- [ ] Responsive design works
- [ ] Page transitions work
- [ ] No console errors
- [ ] Performance is acceptable
Validation
Functionality
- Test all features
- Verify data flow
- Check interactions
Styling
- Visual comparison
- Responsive testing
- Browser testing
Performance
- Run Lighthouse audit
- Check bundle size
- Verify optimization
Common Issues
Field Values Missing:
- Check field key migration
- Verify ACF field groups
- Check field references
Styles Not Applying:
- Verify Tailwind classes
- Check custom SCSS
- Verify build completed
JavaScript Not Working:
- Check component initialization
- Verify
data-componentattribute - Check for JavaScript errors
Best Practices
1. Migrate Incrementally
Don't migrate everything at once:
- Start with simple components
- Migrate section by section
- Test after each migration
2. Keep Old Code
Keep old code until migration is complete:
- Comment out old code
- Keep as reference
- Remove after validation
3. Document Changes
Document migration decisions:
- Why components were structured a certain way
- Field key mappings
- Custom functionality
4. Test Thoroughly
Test everything:
- All pages
- All components
- All functionality
- All browsers
Related Documentation
- Getting Started - Initial setup
- Component System - Component structure
- ACF Integration - ACF patterns
- Troubleshooting - Common issues
Need Help? Check the Troubleshooting Guide or ask the team!