# HVAC Community Events - Transition Guide ## Quick Start To transition to the new architecture: 1. **Backup current plugin** ```bash cp hvac-community-events.php hvac-community-events.php.backup ``` 2. **Replace main plugin file** ```bash cp hvac-community-events-new.php hvac-community-events.php ``` 3. **Test the plugin** - Deactivate plugin - Activate plugin - Check for any errors - Verify pages are working ## What Changed ### Old Architecture - Single 1000+ line `hvac-community-events.php` file - All page definitions hardcoded in activation function - Mixed responsibilities (pages, roles, redirects, etc.) ### New Architecture - Clean 30-line main plugin file - Modular class-based structure - Separation of concerns - Easy to maintain and extend ## Key Components 1. **Main Plugin File** (`hvac-community-events.php`) - Only bootstraps the plugin - Loads the main plugin class 2. **Plugin Class** (`includes/class-hvac-plugin.php`) - Central orchestrator - Manages all components - Handles initialization 3. **Page Manager** (`includes/class-hvac-page-manager.php`) - Creates and manages all pages - Centralized page definitions - Easy to add/modify pages 4. **Template Loader** (`includes/class-hvac-template-loader.php`) - WordPress-compliant template loading - Theme override support - Body class management 5. **Content Files** (`templates/content/`) - Gutenberg block content for status pages - Easy to edit without touching code ## Compatibility The new architecture maintains 100% backward compatibility: - All existing functionality preserved - Legacy redirects still work - All includes are loaded - AJAX handlers intact - Same activation/deactivation behavior ## Benefits 1. **Maintainability**: Each file has a single purpose 2. **Scalability**: Easy to add new features 3. **Testability**: Components can be tested independently 4. **Performance**: Only loads what's needed 5. **Standards**: Follows WordPress best practices ## Troubleshooting If you encounter issues: 1. **Check PHP error log** ```bash tail -f /path/to/error.log ``` 2. **Verify file permissions** ```bash chmod -R 755 hvac-community-events ``` 3. **Clear cache** - WordPress cache - Browser cache - CDN cache (if applicable) 4. **Rollback if needed** ```bash cp hvac-community-events.php.backup hvac-community-events.php ``` ## Next Steps After successful transition: 1. Delete backup file (once confirmed working) 2. Update any custom code to use new classes 3. Train team on new structure 4. Document any customizations ## Support For questions or issues: - Check `/docs/REFACTORING-GUIDE.md` - Review `/docs/CUSTOMIZATION-EXAMPLES.md` - Contact development team