Skip to content

Repository files navigation

Lovable to WordPress

Version: 1.0.0
Status: Production Ready βœ…
Compatibility: WordPress 5.8+, PHP 8.0+, Elementor 3.0+

Transform your Lovable projects into fully functional WordPress websites with Elementor compatibility. Features intelligent plugin recommendations, automatic component detection, and seamless asset migration.


🎯 Features

Core Functionality

  • βœ… ZIP Upload & Analysis - Upload complete Lovable projects directly from GitHub
  • βœ… Intelligent Component Detection - Automatically detects forms, popups, filters, galleries, animations, and CPTs
  • βœ… Smart Plugin Recommendations - AI-powered plugin matching with 6 functionality categories
  • βœ… Elementor Pro/Free Detection - Adapts recommendations based on installed Elementor version
  • βœ… Priority-Based Sorting - Prioritizes already installed plugins β†’ Elementor Pro features β†’ Best compatibility
  • βœ… ZIP Validation - Comprehensive validation (size, structure, security, MIME type)
  • βœ… Asset Import - Automatic media library integration for images and files
  • βœ… CSS Extraction - Preserves Tailwind colors, fonts, and custom styles
  • βœ… Page Creation - Generates WordPress pages with Elementor metadata
  • βœ… Plugin Auto-Install - One-click installation and activation from WordPress.org

Advanced Features

  • 🎨 85-90% Style Preservation - Maintains design fidelity through CSS extraction
  • πŸ”Œ 20+ Plugin Mappings - Curated recommendations for FREE and PREMIUM solutions
  • 🎯 User Preference Memory - Remembers plugin choices for future imports
  • πŸ”’ Security First - Nonce verification, capability checks, file sanitization
  • 🌐 Translation Ready - Full i18n support with .pot file included
  • πŸ“Š Import Statistics - Real-time progress tracking (pages created, plugins installed)
  • ⚑ Hooks & Filters - Extensible architecture with 10+ action hooks

πŸ“¦ Installation

Requirements

  • WordPress 5.8 or higher
  • PHP 8.0 or higher
  • Elementor (Free or Pro)
  • PHP ZipArchive extension
  • upload_max_filesize β‰₯ 50MB (recommended)

Quick Install

  1. Download the plugin:

    git clone https://github.com/WEBLOTI/lovable-to-wordpress.git
  2. Upload to WordPress:

    cp -r lovable-to-wordpress /path/to/wordpress/wp-content/plugins/
  3. Activate:

    • Go to Plugins in WordPress admin
    • Find "Lovable to WordPress"
    • Click "Activate"
  4. Access:

    • Navigate to Lovable to WordPress in admin menu
    • Upload your Lovable project ZIP

πŸš€ Usage

Step 1: Prepare Your Lovable Project

Export from Lovable/GitHub:

git clone <your-lovable-repo>
cd <your-lovable-repo>
zip -r lovable-project.zip .

Required Structure:

lovable-project.zip
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ pages/
β”‚   └── ...
β”œβ”€β”€ public/
β”‚   └── assets/
└── package.json

Step 2: Upload & Analyze

  1. Go to Lovable to WordPress in admin menu
  2. Click "Choose ZIP file or drag here"
  3. Select your lovable-project.zip
  4. Click "Analyze Project"

The system will:

  • βœ… Validate ZIP structure
  • βœ… Extract project information
  • βœ… Detect components (forms, popups, etc.)
  • βœ… Generate plugin recommendations

Step 3: Select Plugins

Review recommendations for each detected functionality:

Example: Forms Detected

  • JetFormBuilder (95%) - FREE βœ… (Recommended - Already Installed)
  • Fluent Forms (90%) - FREE
  • WPForms Lite (85%) - FREE
  • Contact Form 7 (75%) - FREE
  • Skip / Manual Setup

Example: Popups Detected (with Elementor Pro)

  • Elementor Pro Popup Builder (98%) - PREMIUM βœ… (Only option shown)

Example: Animations Detected (with Elementor Free)

  • WPCode (92%) - FREE βœ… (Best free option)
  • Elementor Motion Effects (90%) - NATIVE FREE
  • Custom CSS/JS Animations (85%) - NATIVE FREE

Step 4: Configure Import Options

  • βœ… Automatically install selected plugins - Downloads from WordPress.org
  • βœ… Import images and assets - Uploads to Media Library
  • βœ… Apply Lovable CSS styles - Injects Tailwind and custom CSS
  • ☐ Remember my plugin choices - Saves preferences for future imports

Step 5: Import

Click "Import to WordPress" and wait for completion.

Success Message:

βœ… Import Completed Successfully!
5 pages created | 3 plugins installed

πŸ”§ Plugin Mappings

Supported Functionalities

Functionality Detection Patterns Recommended Solutions Free Options
Popups/Modals Dialog, Modal, Popover Elementor Pro (98%), JetPopup (95%), Popup Maker (90%) Popup Maker, Popup Anything
Forms react-hook-form, useForm JetFormBuilder (95%), Fluent Forms (90%), WPForms (85%) All 4 options
Filters/Search filter, search, Select JetSmartFilters (95%), Search & Filter (80%) Search & Filter
CPTs mockListings, data/ JetEngine (95%), ACF (90%), Meta Box (85%) ACF, Meta Box, CPTUI
Gallery Gallery, Carousel JetEngine (95%), JetElements (92%), Elementor (90%) Elementor native
Animations framer-motion, motion Elementor Pro (95%), WPCode (92%), Elementor (90%) WPCode, Custom CSS

Priority System

Plugins are sorted by:

  1. Active Plugins (Highest Priority) - User's existing setup
  2. Installed Plugins - Already downloaded
  3. Elementor Pro Features - If Pro is active
  4. Compatibility Score - Technical best match

🎨 Style Preservation

CSS Extraction

Automatically extracts and converts:

  • βœ… Tailwind utility classes β†’ WordPress CSS
  • βœ… Custom colors & gradients
  • βœ… Typography (fonts, sizes, weights)
  • βœ… Spacing (margins, paddings)
  • βœ… Flexbox/Grid layouts
  • βœ… Animations & transitions

Example:

Lovable (Tailwind):

<div className="bg-gradient-to-r from-purple-600 to-blue-500 p-8 rounded-lg">
  <h1 className="text-4xl font-bold text-white">Hello</h1>
</div>

WordPress (Generated CSS):

.lovable-section-1 {
  background: linear-gradient(to right, #9333ea, #3b82f6);
  padding: 2rem;
  border-radius: 0.5rem;
}
.lovable-section-1 h1 {
  font-size: 2.25rem;
  font-weight: 700;
  color: #ffffff;
}

πŸ”Œ Developer Hooks

Actions

// Before import starts
do_action('l2wp_before_import_start', $analysis_result, $plugin_choices);

// After each page is created
do_action('l2wp_page_created_from_lovable', $page_id, $page_data);

// After import completes
do_action('l2wp_after_import_complete', $import_status);

// Before uninstall
do_action('l2wp_before_uninstall');

// After uninstall
do_action('l2wp_after_uninstall');

Filters

// Modify max ZIP size (default 50MB)
add_filter('l2wp_max_zip_size', function($size) {
    return 104857600; // 100MB
});

// Modify required ZIP structure
add_filter('l2wp_required_zip_structure', function($structure) {
    $structure[] = 'custom-folder/';
    return $structure;
});

// Modify allowed file extensions
add_filter('l2wp_allowed_file_extensions', function($extensions) {
    $extensions[] = 'pdf';
    return $extensions;
});

// Control uninstall data deletion
add_filter('l2wp_uninstall_delete_data', function($delete) {
    return false; // Keep data on uninstall
});

Helper Functions

// Check if Elementor is active
l2wp_is_elementor_active();

// Check if plugin is active
l2wp_is_plugin_active('jetformbuilder');

// Install and activate plugin
l2wp_install_plugin('jetformbuilder');

// Import assets
l2wp_import_assets($assets_array);

// Replace placeholders in content
l2wp_replace_placeholders($content, $post_id);

πŸ“Š Technical Architecture

Class Structure

L2WP_Main (lovable-to-wordpress.php)
β”œβ”€β”€ L2WP_ZIP_Validator (class-l2wp-zip-validator.php)
β”œβ”€β”€ L2WP_ZIP_Analyzer (class-l2wp-zip-analyzer.php)
β”œβ”€β”€ L2WP_Component_Detector (class-l2wp-component-detector.php)
β”œβ”€β”€ L2WP_Plugin_Recommender (class-l2wp-plugin-recommender.php)
β”œβ”€β”€ L2WP_CSS_Extractor (class-l2wp-css-extractor.php)
β”œβ”€β”€ L2WP_Elementor_Builder (class-l2wp-elementor-builder.php)
β”œβ”€β”€ L2WP_API_Bridge (class-l2wp-api-bridge.php)
β”œβ”€β”€ L2WP_Export_Engine (class-l2wp-export-engine.php)
β”œβ”€β”€ L2WP_Elementor_Mapper (class-l2wp-elementor-mapper.php)
β”œβ”€β”€ L2WP_Asset_Loader (class-l2wp-asset-loader.php)
└── L2WP_Dynamic_Tags (class-l2wp-dynamic-tags.php)

Data Flow

1. ZIP Upload
   ↓
2. L2WP_ZIP_Validator validates
   ↓
3. L2WP_ZIP_Analyzer extracts structure
   ↓
4. L2WP_Component_Detector scans for patterns
   ↓
5. L2WP_Plugin_Recommender generates options
   ↓
6. User selects plugins
   ↓
7. L2WP_Main::handle_import_submission()
   ↓
8. Install plugins via l2wp_install_plugin()
   ↓
9. Create pages via wp_insert_post()
   ↓
10. Import assets via l2wp_import_assets()
    ↓
11. Extract CSS via L2WP_CSS_Extractor
    ↓
12. Redirect with success message

πŸ”’ Security

Implemented Measures

  • βœ… Nonce Verification - All forms protected
  • βœ… Capability Checks - manage_options required
  • βœ… Input Sanitization - sanitize_text_field(), esc_html(), etc.
  • βœ… File Validation - MIME type, extension, size checks
  • βœ… ZIP Security Scan - Detects dangerous files (.php, .exe, ../)
  • βœ… SQL Injection Prevention - Prepared statements
  • βœ… XSS Prevention - Output escaping
  • βœ… CSRF Protection - Nonces on all actions

Best Practices

// βœ… GOOD - Sanitized and escaped
$plugin_slug = sanitize_text_field($_POST['plugin_slug']);
echo esc_html($plugin_slug);

// ❌ BAD - Direct output
echo $_POST['plugin_slug'];

πŸ§ͺ Testing

Manual Testing Checklist

  • Upload valid Lovable ZIP β†’ Success
  • Upload invalid ZIP β†’ Error message shown
  • Upload oversized ZIP β†’ "File too large" error
  • Upload non-ZIP file β†’ "Must be ZIP" error
  • Detect components correctly
  • Show correct plugin recommendations
  • Prioritize installed plugins
  • Install plugins successfully
  • Create pages with correct metadata
  • Import assets to media library
  • Extract and apply CSS
  • Show success message with stats
  • Reset cache works
  • Uninstall cleans up data

Test ZIP Structure

Create a test ZIP:

mkdir lovable-test
cd lovable-test
mkdir -p src/components src/pages public/assets
echo '{"name": "test-project"}' > package.json
echo "export default function Home() {}" > src/pages/Home.tsx
zip -r ../lovable-test.zip .

πŸ“ Changelog

[1.0.0] - 2025-10-25

Added

  • βœ… Complete ZIP validation system
  • βœ… Intelligent plugin recommendation engine
  • βœ… Elementor Pro/Free detection
  • βœ… Priority-based plugin sorting
  • βœ… Automatic plugin installation from WordPress.org
  • βœ… Asset import to media library
  • βœ… CSS extraction and application
  • βœ… Page creation with Elementor metadata
  • βœ… Import statistics tracking
  • βœ… User preference memory
  • βœ… Security scans for uploaded ZIPs
  • βœ… Error handling and validation messages
  • βœ… Translation support (.pot file)
  • βœ… Comprehensive uninstall cleanup
  • βœ… Developer hooks and filters
  • βœ… PHPCS configuration
  • βœ… WordPress Coding Standards compliance

Changed

  • πŸ”„ Refactored all classes to L2WP_ prefix
  • πŸ”„ Updated constants to L2WP_ format
  • πŸ”„ Improved function naming consistency
  • πŸ”„ Enhanced PHPDoc documentation

Fixed

  • βœ… Helper functions fully implemented
  • βœ… Template synchronization
  • βœ… Message display after import
  • βœ… Plugin installation error handling

🀝 Contributing

Development Setup

git clone https://github.com/WEBLOTI/lovable-to-wordpress.git
cd lovable-to-wordpress

Coding Standards

Run PHPCS:

phpcs --standard=WordPress lovable-to-wordpress.php

Pull Request Process

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Open Pull Request

πŸ“„ License

GPL v2 or later - https://www.gnu.org/licenses/gpl-2.0.html


πŸ‘¨β€πŸ’» Author

WEBLOTI
GitHub: @WEBLOTI


πŸ™ Acknowledgments

  • Elementor team for the excellent page builder
  • Crocoblock for JetEngine ecosystem
  • WordPress community for coding standards
  • Lovable for the amazing design tool

πŸ“ž Support


🎯 Roadmap

v1.1.0 (Next Release)

  • Unit tests (PHPUnit)
  • Integration tests
  • GitHub Actions CI/CD
  • Advanced Elementor template generation
  • Multi-page imports
  • Custom field mapping UI

v2.0.0 (Future)

  • Gutenberg support
  • REST API endpoints
  • Import templates library
  • Export WordPress back to Lovable
  • Cloud storage integration

Made with ❀️ by WEBLOTI

⭐ Star us on GitHub if this helped you!

About

Export Lovable designs to WordPress with full Elementor compatibility

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages