Files
Zeitfresser-Wordpress-Theme/template-parts/content-single.php
T
Dome 9f92958651 refactor(core): introduce modular architecture and restructure theme into clean, maintainable components
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.
2026-04-26 03:16:00 +02:00

78 lines
2.4 KiB
PHP

<?php
/**
* Template part for displaying single posts.
*
* @package zeitfresser
*/
$toc_payload = zeitfresser_build_toc_payload( get_the_ID() );
$has_floating_toc = ! empty( $toc_payload['items'] );
?>
<div class="zeitfresser-article-heading">
<h1 class="page-title"><?php the_title(); ?></h1>
</div>
<?php if ( $has_floating_toc ) : ?>
<?php zeitfresser_render_floating_toc( get_the_ID() ); ?>
<?php endif; ?>
<div class="single-post">
<div class="post-content">
<!-- Meta Info -->
<div class="ihead info">
<ul class="list-inline">
<!-- Date (TRUE) -->
<?php
$archive_year = get_the_time('Y');
$archive_month = get_the_time('m');
$archive_day = get_the_time('d');
?>
<li class="post-date">
<i class="icon-calendar"></i>
<a href="<?php echo esc_url( get_day_link( $archive_year, $archive_month, $archive_day ) ); ?>">
<?php echo esc_html( get_the_date() ); ?>
</a>
</li>
</ul>
<!-- Comments (TRUE) -->
<span class="comments">
<svg width="20px" height="20px" viewBox="0 0 24 24">
<g>
<path d="M17,3.25H7A4.756,4.756,0,0,0,2.25,8V21a.75.75,0,0,0,1.28.53l2.414-2.414a1.246,1.246,0,0,1,.885-.366H17A4.756,4.756,0,0,0,21.75,14V8A4.756,4.756,0,0,0,17,3.25Z"/>
</g>
</svg>
<?php comments_popup_link( __( '0', 'zeitfresser' ), __( '1', 'zeitfresser' ), __( '%', 'zeitfresser' ) ); ?>
</span>
</div>
<!-- Featured Image (FALSE → entfernt) -->
<!-- Article Content -->
<article>
<div class="inner-article-content">
<?php echo $toc_payload['content']; // phpcs:ignore ?>
</div>
<?php
wp_link_pages( array(
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'zeitfresser' ),
'after' => '</div>',
) );
?>
</article>
</div>
<!-- Author Block (FALSE → entfernt) -->
<!-- Categories (FALSE → entfernt) -->
<!-- Tags (FALSE → entfernt) -->
<!-- Social Share (FALSE → entfernt) -->
</div>