From 9f92958651dc7ea87e18a97d858b3d84bae7786f Mon Sep 17 00:00:00 2001 From: Dome Date: Sun, 26 Apr 2026 03:16:00 +0200 Subject: [PATCH 1/4] refactor(core): introduce modular architecture and restructure theme into clean, maintainable components MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit introduces a complete internal refactoring of the theme architecture, transitioning from a monolithic functions.php structure to a modular, scalable system. ### Key Changes #### 1. Modular Architecture - Extracted core logic into dedicated modules under `/inc/` - Introduced clear separation of concerns: - `helpers/` → shared utility functions - `performance/` → optimization and media processing logic - `customizer/` → fully modularized Customizer structure - `template-*` → presentation and template-related logic #### 2. Customizer Refactor - Replaced legacy monolithic customizer with modular system: - `core.php` → base setup - `general.php`, `layout.php`, `toc.php`, `social.php` → feature-based modules - Improved maintainability and extensibility for future settings #### 3. Performance Layer Separation - Moved performance-related logic into `/inc/performance/` - Clearly separated: - frontend performance tweaks (scripts, CSS, cleanup) - media optimization tools (batch processing, cleanup UI) - Reduced coupling between UI, logic, and processing #### 4. Media Optimization Pipeline Stabilization - Re-aligned upload pipeline with WordPress native flow - Restored proper use of `wp_generate_attachment_metadata` - Ensured compatibility with: - format conversion (AVIF/WebP) - responsive image generation - WordPress core image handling #### 5. Cleaner Hook Management - Removed duplicated hooks and redundant filters - Standardized hook priorities and responsibilities - Ensured consistent use of feature toggles (`get_theme_mod`) #### 6. Improved Code Quality - Reduced function duplication - Standardized naming conventions - Improved readability and inline documentation - Removed legacy patterns and implicit dependencies #### 7. Asset Handling Improvements - Introduced centralized asset versioning via `filemtime` - Improved script loading strategy (defer non-critical JS) - Cleaner enqueue structure for styles and scripts #### 8. Foundation for Future Development This refactor lays the groundwork for: - easier feature expansion - better testability - improved debugging capabilities - long-term maintainability ### Breaking Changes - Internal file structure has changed significantly - Direct modifications to old functions.php logic may no longer apply - Customizer extensions must now hook into modular structure --- This is a purely structural and architectural release. No intentional changes to frontend behavior were introduced, but the internal system is now significantly more robust and maintainable. --- footer.php | 5 +- functions.php | 709 ++++++++---------- header.php | 99 +-- inc/blocks/blocks.php | 20 - .../default-footer-copyright.php | 5 - .../footer-copyright/footer-copyright.php | 26 - .../container-width/container-width.php | 64 -- .../customizer-container-width.js | 10 - inc/blocks/general/default-general.php | 25 - inc/blocks/general/general.php | 30 - inc/blocks/general/toc-options.php | 99 --- inc/blocks/includes/button/button.css | 18 - inc/blocks/includes/button/button.js | 15 - .../includes/button/class-button-control.php | 74 -- .../custom-html/class-custom-html.php | 24 - .../multicheck/class-multi-check-control.php | 86 --- inc/blocks/includes/multicheck/multi-check.js | 30 - inc/blocks/includes/register-controls.php | 17 - inc/blocks/includes/sanitize.php | 50 -- inc/blocks/includes/template-social-share.php | 56 -- .../includes/toggle/class-toggle-control.php | 65 -- inc/blocks/includes/toggle/toggle.css | 64 -- inc/blocks/includes/toggle/toggle.js | 18 - .../post-detail/default-post-detail.php | 61 -- inc/blocks/post-detail/post-detail.php | 9 - .../post-snippet/default-post-snippet.php | 61 -- inc/blocks/post-snippet/excerpt/excerpt.php | 23 - inc/blocks/post-snippet/post-snippet.php | 25 - .../site-identity/default-site-identity.php | 11 - inc/blocks/site-identity/site-identity.php | 9 - .../site-tagline/site-tagline.php | 18 - .../site-identity/site-title/site-title.php | 18 - inc/{customizer.php => customizer/core.php} | 140 ++-- inc/customizer/general.php | 90 +++ inc/customizer/layout.php | 54 ++ .../social.php} | 56 +- inc/customizer/toc.php | 80 ++ inc/{ => helpers}/zeitfresser-helpers.php | 48 +- inc/jetpack.php | 67 -- inc/{ => performance}/performance-tools.php | 13 +- inc/zeitfresser-toc.php | 46 +- single.php | 46 +- style.css | 2 +- template-parts/content-search.php | 137 +--- template-parts/content-single.php | 172 +---- template-parts/content.php | 138 +--- template-parts/related-articles.php | 74 +- 47 files changed, 872 insertions(+), 2135 deletions(-) delete mode 100644 inc/blocks/blocks.php delete mode 100644 inc/blocks/footer-copyright/default-footer-copyright.php delete mode 100644 inc/blocks/footer-copyright/footer-copyright.php delete mode 100644 inc/blocks/general/container-width/container-width.php delete mode 100644 inc/blocks/general/container-width/customizer-container-width.js delete mode 100644 inc/blocks/general/default-general.php delete mode 100644 inc/blocks/general/general.php delete mode 100644 inc/blocks/general/toc-options.php delete mode 100644 inc/blocks/includes/button/button.css delete mode 100644 inc/blocks/includes/button/button.js delete mode 100644 inc/blocks/includes/button/class-button-control.php delete mode 100644 inc/blocks/includes/custom-html/class-custom-html.php delete mode 100644 inc/blocks/includes/multicheck/class-multi-check-control.php delete mode 100644 inc/blocks/includes/multicheck/multi-check.js delete mode 100644 inc/blocks/includes/register-controls.php delete mode 100644 inc/blocks/includes/sanitize.php delete mode 100644 inc/blocks/includes/template-social-share.php delete mode 100644 inc/blocks/includes/toggle/class-toggle-control.php delete mode 100644 inc/blocks/includes/toggle/toggle.css delete mode 100644 inc/blocks/includes/toggle/toggle.js delete mode 100644 inc/blocks/post-detail/default-post-detail.php delete mode 100644 inc/blocks/post-detail/post-detail.php delete mode 100644 inc/blocks/post-snippet/default-post-snippet.php delete mode 100644 inc/blocks/post-snippet/excerpt/excerpt.php delete mode 100644 inc/blocks/post-snippet/post-snippet.php delete mode 100644 inc/blocks/site-identity/default-site-identity.php delete mode 100644 inc/blocks/site-identity/site-identity.php delete mode 100644 inc/blocks/site-identity/site-tagline/site-tagline.php delete mode 100644 inc/blocks/site-identity/site-title/site-title.php rename inc/{customizer.php => customizer/core.php} (66%) create mode 100644 inc/customizer/general.php create mode 100644 inc/customizer/layout.php rename inc/{blocks/general/social-links/social-links.php => customizer/social.php} (53%) create mode 100644 inc/customizer/toc.php rename inc/{ => helpers}/zeitfresser-helpers.php (74%) delete mode 100644 inc/jetpack.php rename inc/{ => performance}/performance-tools.php (98%) diff --git a/footer.php b/footer.php index 2132184..94d3e1b 100644 --- a/footer.php +++ b/footer.php @@ -5,7 +5,10 @@ * @package zeitfresser */ -$copyright = get_theme_mod( 'footer_copyright_text', zeitfresser_get_default_footer_copyright() ); +$copyright = get_theme_mod( + 'footer_copyright_text', + '© ' . date('Y') . ' Zeitfresser' +); ?>