Files
Zeitfresser-Wordpress-Theme/inc/customizer/layout.php
T
Dome 6bf38ae05d refactor(toc, customizer): improve TOC architecture and reorganize customizer settings
- Reorganized Customizer structure for improved clarity and maintainability
- Introduced consistent default values for all settings to ensure stable fallbacks
  when no user preferences are defined

- Refactored scroll-driven TOC implementation:
  - Optimized scroll handling using requestAnimationFrame
  - Reduced layout thrashing and unnecessary DOM reads
  - Improved heading detection logic (deterministic viewport trigger)
  - Enhanced positioning logic (responsive alignment + sidebar awareness)
  - Improved footer collision handling for more robust layout behavior

- Added optional IntersectionObserver-based TOC implementation:
  - Event-driven alternative to scroll-based approach
  - Currently not enabled by default
  - May not be supported long-term due to less deterministic behavior

- General cleanup and internal consistency improvements

chore: bump version to 2.4.0
2026-04-26 18:48:28 +02:00

55 lines
1.3 KiB
PHP

<?php
/**
* Layout / Container Settings
*
* @package zeitfresser
*/
add_action( 'customize_register', 'zeitfresser_layout_options' );
function zeitfresser_layout_options( $wp_customize ) {
/**
* Container Width
*/
$wp_customize->add_setting(
'container_width',
array(
'default' => 1400,
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
'container_width',
array(
'type' => 'number',
'section' => 'ztfr_general',
'label' => esc_html__( 'Container Width', 'zeitfresser' ),
'description' => esc_html__( 'Maximum width of the content container in pixels.', 'zeitfresser' ),
'priority' => 22,
'input_attrs' => array(
'min' => 800,
'max' => 2000,
'step' => 10,
),
)
);
}
/**
* Apply container width via CSS variable
*/
add_action( 'wp_head', 'zeitfresser_container_width_dynamic_css' );
function zeitfresser_container_width_dynamic_css() {
$container_width = (int) get_theme_mod( 'container_width' );
if ( $container_width <= 0 ) {
$container_width = 1400;
}
echo '<style>:root{--container-width:' . esc_attr( $container_width ) . 'px;}</style>';
}