Files
Minecraft-Modern-Theme/Minecraft-Modern-Theme/inc/customizer.php
2026-02-10 23:25:59 +01:00

589 lines
29 KiB
PHP

<?php
/**
* Minecraft Modern Theme - Customizer Settings
*
* Enthält Einstellungen für:
* - Header Slider & Hero
* - Theme Presets (Nether, End, Classic)
* - Farben & Darstellung
* - Social Media
* - Footer
* - Login
* - Sidebar
* - Import/Export
*/
function minecraft_modern_customize_register( $wp_customize ) {
// =========================================================================
// === 1. HEADER-BEREICH ===================================================
// =========================================================================
// --- Sektion: Header Slider ---
$wp_customize->add_section( 'header_slider', array(
'title' => 'Header Slider',
'priority' => 20,
'description' => 'Konfiguriere den großen Slider auf der Startseite.',
) );
// Checkbox zum Aktivieren des Sliders
$wp_customize->add_setting( 'slider_enabled', array(
'default' => false,
'transport' => 'refresh',
'sanitize_callback' => 'wp_validate_boolean',
) );
$wp_customize->add_control( 'slider_enabled', array(
'label' => 'Header Slider aktivieren',
'section' => 'header_slider',
'settings' => 'slider_enabled',
'type' => 'checkbox',
) );
// Dynamische Slider-Bilder, Titel und Untertitel
for ($i = 1; $i <= 5; $i++) {
$wp_customize->add_setting( 'slider_image_' . $i, array( 'sanitize_callback' => 'esc_url_raw' ) );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'slider_image_' . $i, array(
'label' => sprintf( 'Banner %d - Bild', $i ),
'section' => 'header_slider',
'settings' => 'slider_image_' . $i,
) ) );
$wp_customize->add_setting( 'slider_title_' . $i, array( 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control( 'slider_title_' . $i, array(
'label' => sprintf( 'Banner %d - Titel', $i ),
'section' => 'header_slider',
'settings' => 'slider_title_' . $i,
'type' => 'text',
) );
$wp_customize->add_setting( 'slider_subtitle_' . $i, array( 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control( 'slider_subtitle_' . $i, array(
'label' => sprintf( 'Banner %d - Untertitel', $i ),
'section' => 'header_slider',
'settings' => 'slider_subtitle_' . $i,
'type' => 'text',
) );
}
// Slider Text- & Stil-Einstellungen
$wp_customize->add_setting( 'slider_font_family', array( 'default' => 'Raleway', 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control( 'slider_font_family', array(
'label' => 'Schriftart', 'section' => 'header_slider', 'settings' => 'slider_font_family', 'type' => 'select',
'choices' => array( 'Raleway' => 'Raleway', 'Poppins' => 'Poppins', 'Montserrat' => 'Montserrat', 'Oswald' => 'Oswald', 'Roboto' => 'Roboto', 'Lato' => 'Lato' ),
) );
$wp_customize->add_setting( 'slider_font_size', array( 'default' => 'mittel', 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control( 'slider_font_size', array(
'label' => 'Schriftgröße', 'section' => 'header_slider', 'settings' => 'slider_font_size', 'type' => 'select',
'choices' => array( 'klein' => 'Klein', 'mittel' => 'Mittel', 'gross' => 'Groß', 'extra-gross' => 'Extra Groß' ),
) );
$wp_customize->add_setting( 'slider_font_color', array( 'default' => '#ffffff', 'sanitize_callback' => 'sanitize_hex_color' ) );
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'slider_font_color', array(
'label' => 'Schriftfarbe', 'section' => 'header_slider', 'settings' => 'slider_font_color',
) ) );
// Header-Höhe
$wp_customize->add_setting( 'header_height', array( 'default' => 'mittel', 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control( 'header_height', array(
'label' => 'Header-Höhe', 'section' => 'header_slider', 'settings' => 'header_height', 'type' => 'select',
'choices' => array( 'klein' => 'Klein', 'mittel' => 'Mittel', 'gross' => 'Groß' ),
) );
$wp_customize->add_setting( 'slider_hide_arrows', array( 'default' => false, 'sanitize_callback' => 'wp_validate_boolean' ) );
$wp_customize->add_control( 'slider_hide_arrows', array(
'label' => 'Pfeile ausblenden', 'section' => 'header_slider', 'settings' => 'slider_hide_arrows', 'type' => 'checkbox',
) );
$wp_customize->add_setting( 'slider_hide_pagination', array( 'default' => false, 'sanitize_callback' => 'wp_validate_boolean' ) );
$wp_customize->add_control( 'slider_hide_pagination', array(
'label' => 'Paginierung (Punkte) ausblenden', 'section' => 'header_slider', 'settings' => 'slider_hide_pagination', 'type' => 'checkbox',
) );
// --- Sektion: Startseiten-Hero (Fallback) ---
$wp_customize->add_section( 'hero_section', array(
'title' => 'Startseiten-Hero (wenn Slider deaktiviert)',
'priority' => 21,
'description' => 'Diese Inhalte werden angezeigt, wenn der Slider ausgeschaltet ist.',
) );
$wp_customize->add_setting( 'hero_title', array( 'default' => 'Willkommen auf unserem Server', 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control( 'hero_title', array( 'label' => 'Haupttitel', 'section' => 'hero_section', 'settings' => 'hero_title', 'type' => 'text' ) );
$wp_customize->add_setting( 'hero_subtitle', array( 'default' => 'Trete einer Community voller Abenteuer bei.', 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control( 'hero_subtitle', array( 'label' => 'Untertitel', 'section' => 'hero_section', 'settings' => 'hero_subtitle', 'type' => 'text' ) );
$wp_customize->add_setting( 'hero_bg_image', array( 'sanitize_callback' => 'esc_url_raw' ) );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'hero_bg_image', array(
'label' => 'Hintergrundbild', 'section' => 'hero_section', 'settings' => 'hero_bg_image',
) ) );
$wp_customize->add_setting( 'hero_button_1_text', array( 'default' => 'Zum Forum', 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control( 'hero_button_1_text', array( 'label' => 'Button 1 Text', 'section' => 'hero_section', 'settings' => 'hero_button_1_text', 'type' => 'text' ) );
$wp_customize->add_setting( 'hero_button_1_url', array( 'default' => '#', 'sanitize_callback' => 'esc_url_raw' ) );
$wp_customize->add_control( 'hero_button_1_url', array( 'label' => 'Button 1 URL', 'section' => 'hero_section', 'settings' => 'hero_button_1_url', 'type' => 'url' ) );
$wp_customize->add_setting( 'hero_button_2_text', array( 'default' => 'Zum Teamspeak', 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control( 'hero_button_2_text', array( 'label' => 'Button 2 Text', 'section' => 'hero_section', 'settings' => 'hero_button_2_text', 'type' => 'text' ) );
$wp_customize->add_setting( 'hero_button_2_url', array( 'default' => '#', 'sanitize_callback' => 'esc_url_raw' ) );
$wp_customize->add_control( 'hero_button_2_url', array( 'label' => 'Button 2 URL', 'section' => 'hero_section', 'settings' => 'hero_button_2_url', 'type' => 'url' ) );
// --- Checkbox: Seitentitel auf Startseite verstecken ---
$wp_customize->add_setting( 'show_home_title', array(
'default' => false,
'sanitize_callback' => 'wp_validate_boolean',
) );
$wp_customize->add_control( 'show_home_title', array(
'label' => 'Seitentitel "Home" anzeigen',
'description' => 'Aktiviere diese Option, wenn der Titel "Home" über dem Slider/Inhalt angezeigt werden soll.',
'section' => 'hero_section',
'settings' => 'show_home_title',
'type' => 'checkbox',
) );
// =========================================================================
// === 2. FARBEN & DARSTELLUNG (KOMBINIERT) ================================
// =========================================================================
// --- Sektion: Farben & Darstellung ---
$wp_customize->add_section( 'theme_appearance_settings', array(
'title' => 'Farben & Darstellung',
'priority' => 30,
) );
// =========================================================================
// === NEU: THEME PRESETS (VOREINSTELLUNGEN) ==============================
// =========================================================================
$wp_customize->add_setting( 'theme_color_preset', array(
'default' => 'classic',
'sanitize_callback' => 'sanitize_key',
'transport' => 'refresh',
) );
$wp_customize->add_control( 'theme_color_preset', array(
'label' => 'Theme Preset (Farbschema)',
'description' => 'Wähle ein voreingestelltes Farbschema (z. B. für Nether oder End Dimension).',
'section' => 'theme_appearance_settings',
'settings' => 'theme_color_preset',
'type' => 'select',
'priority' => 1, // Zeig es ganz oben in dieser Sektion an
'choices' => array(
'classic' => 'Classic Minecraft (Diamant-Blau)',
'nether' => 'Nether (Lava-Rot)',
'end' => 'The End (Ender-Purpur)',
),
) );
// =========================================================================
// === ENDE THEME PRESETS ==================================================
// =========================================================================
// Akzentfarbe
$wp_customize->add_setting( 'primary_accent_color', array( 'default' => '#00d4ff', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'refresh' ) );
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'primary_accent_color', array(
'label' => 'Akzentfarbe', 'section' => 'theme_appearance_settings', 'settings' => 'primary_accent_color',
) ) );
// Hintergrundfarbe
$wp_customize->add_setting( 'background_color', array(
'default' => '#ffffff',
'sanitize_callback' => 'sanitize_hex_color',
'transport' => 'refresh',
) );
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'background_color', array(
'label' => 'Hintergrundfarbe',
'section' => 'theme_appearance_settings',
'settings' => 'background_color',
) ) );
// Dark / Light Mode
$wp_customize->add_setting( 'default_theme_mode', array( 'default' => 'dark', 'sanitize_callback' => 'sanitize_key' ) );
$wp_customize->add_control( 'default_theme_mode', array(
'label' => 'Standard-Theme-Modus', 'section' => 'theme_appearance_settings', 'type' => 'radio',
'choices' => array( 'dark' => 'Dark Mode (Standard)', 'light' => 'Light Mode' ),
) );
// =========================================================================
// === 3. SIDEBAR EINSTELLUNGEN ============================================
// =========================================================================
$wp_customize->add_section( 'sidebar_settings', array(
'title' => 'Sidebar Einstellungen',
'priority' => 35,
'description' => 'Konfiguriere die Sidebar auf der Startseite.',
) );
// Sidebar aktivieren
$wp_customize->add_setting( 'homepage_sidebar_enabled', array(
'default' => false,
'sanitize_callback' => 'wp_validate_boolean',
) );
$wp_customize->add_control( 'homepage_sidebar_enabled', array(
'label' => 'Sidebar auf Startseite aktivieren',
'description' => 'Zeigt eine Sidebar neben dem Hauptinhalt an.',
'section' => 'sidebar_settings',
'settings' => 'homepage_sidebar_enabled',
'type' => 'checkbox',
) );
// Sidebar Position
$wp_customize->add_setting( 'homepage_sidebar_position', array(
'default' => 'right',
'sanitize_callback' => 'sanitize_key',
) );
$wp_customize->add_control( 'homepage_sidebar_position', array(
'label' => 'Sidebar Position',
'section' => 'sidebar_settings',
'settings' => 'homepage_sidebar_position',
'type' => 'select',
'choices' => array(
'left' => 'Links',
'right' => 'Rechts',
),
) );
// =========================================================================
// === 4. SOCIAL MEDIA =====================================================
// =========================================================================
$wp_customize->add_section( 'social_links', array( 'title' => 'Social Media Links', 'priority' => 40 ) );
$social_platforms = array( 'discord' => 'Discord', 'youtube' => 'YouTube', 'twitter' => 'Twitter (X)', 'facebook' => 'Facebook', 'instagram' => 'Instagram', 'tiktok' => 'TikTok', 'twitch' => 'Twitch', 'steam' => 'Steam', 'github' => 'GitHub', 'linkedin' => 'LinkedIn', 'pinterest' => 'Pinterest', 'reddit' => 'Reddit', 'teamspeak' => 'Teamspeak', 'spotify' => 'Spotify' );
foreach ($social_platforms as $key => $label) {
$wp_customize->add_setting( 'social_' . $key, array( 'sanitize_callback' => 'esc_url_raw' ) );
$wp_customize->add_control( 'social_' . $key, array(
'label' => $label . ' URL', 'section' => 'social_links', 'settings' => 'social_' . $key, 'type' => 'url',
) );
}
// =========================================================================
// === 5. FOOTER-BEREICH ==================================================
// =========================================================================
$wp_customize->add_section( 'footer_settings', array( 'title' => 'Footer-Einstellungen', 'priority' => 50 ) );
// Copyright-Text
$wp_customize->add_setting( 'footer_copyright', array( 'default' => '&copy; ' . date('Y') . ' ' . get_bloginfo('name'), 'sanitize_callback' => 'wp_kses_post' ) );
$wp_customize->add_control( 'footer_copyright', array(
'label' => 'Copyright-Text', 'section' => 'footer_settings', 'settings' => 'footer_copyright', 'type' => 'textarea',
) );
// Impressum & Datenschutz Links
$wp_customize->add_setting( 'footer_impressum_url', array( 'sanitize_callback' => 'esc_url_raw' ) );
$wp_customize->add_control( 'footer_impressum_url', array(
'label' => 'URL für Impressum', 'section' => 'footer_settings', 'settings' => 'footer_impressum_url', 'type' => 'url',
) );
$wp_customize->add_setting( 'footer_datenschutz_url', array( 'sanitize_callback' => 'esc_url_raw' ) );
$wp_customize->add_control( 'footer_datenschutz_url', array(
'label' => 'URL für Datenschutz', 'section' => 'footer_settings', 'settings' => 'footer_datenschutz_url', 'type' => 'url',
) );
// Footer-Credit
$wp_customize->add_setting( 'show_footer_credit', array( 'default' => true, 'sanitize_callback' => 'wp_validate_boolean' ) );
$wp_customize->add_control( 'show_footer_credit', array(
'label' => 'Footer-Credit ("Minecraft Theme Erstellt von...") anzeigen', 'section' => 'footer_settings', 'settings' => 'show_footer_credit', 'type' => 'checkbox',
) );
// =========================================================================
// === 6. ZUSÄTZLICHE FUNKTIONEN ==========================================
// =========================================================================
// --- Sektion: FAQ Einstellungen ---
$wp_customize->add_section( 'faq_settings', array( 'title' => 'FAQ Einstellungen', 'priority' => 60 ) );
$wp_customize->add_setting( 'faq_enabled', array( 'default' => true, 'sanitize_callback' => 'wp_validate_boolean' ) );
$wp_customize->add_control( 'faq_enabled', array(
'label' => 'FAQ System aktivieren', 'section' => 'faq_settings', 'settings' => 'faq_enabled', 'type' => 'checkbox',
) );
// --- Sektion: Team Einstellungen ---
$wp_customize->add_section( 'team_settings', array( 'title' => 'Team Einstellungen', 'priority' => 65 ) );
$wp_customize->add_setting( 'team_enabled', array( 'default' => true, 'sanitize_callback' => 'wp_validate_boolean' ) );
$wp_customize->add_control( 'team_enabled', array(
'label' => 'Team Showcase aktivieren', 'section' => 'team_settings', 'settings' => 'team_enabled', 'type' => 'checkbox',
) );
// =========================================================================
// === 7. LOGIN-BEREICH ====================================================
// =========================================================================
$wp_customize->add_section( 'login_settings', array(
'title' => 'Login-Einstellungen',
'priority' => 70,
'description' => 'Passe das Aussehen der wp-admin Login-Seite an.',
) );
// Login-Hintergrundbild
$wp_customize->add_setting( 'login_background_image', array(
'sanitize_callback' => 'esc_url_raw',
'transport' => 'refresh',
) );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'login_background_image', array(
'label' => 'Login-Hintergrundbild',
'section' => 'login_settings',
'settings' => 'login_background_image',
) ) );
// Login-Logo
$wp_customize->add_setting( 'login_logo', array(
'sanitize_callback' => 'esc_url_raw',
'transport' => 'refresh',
) );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'login_logo', array(
'label' => 'Login-Logo (ersetzt das WordPress-Logo)',
'section' => 'login_settings',
'settings' => 'login_logo',
) ) );
// Multi-Avatar UUIDs
for ($i = 1; $i <= 5; $i++) {
$wp_customize->add_setting( 'login_avatar_uuid_' . $i, array(
'sanitize_callback' => 'sanitize_text_field',
'transport' => 'refresh',
) );
$wp_customize->add_control( 'login_avatar_uuid_' . $i, array(
'label' => sprintf( 'Avatar %d UUID', $i ),
'description' => sprintf( 'Gib die UUID für den %d. Avatar an. (Leer lassen, um zu deaktivieren)', $i ),
'section' => 'login_settings',
'settings' => 'login_avatar_uuid_' . $i,
'type' => 'text',
) );
}
// Slider-Geschwindigkeit
$wp_customize->add_setting( 'login_avatar_slider_speed', array(
'default' => 4,
'sanitize_callback' => 'absint',
'transport' => 'refresh',
) );
$wp_customize->add_control( 'login_avatar_slider_speed', array(
'label' => 'Avatar-Wechsel (in Sekunden)',
'description' => 'Wie viele Sekunden soll ein Avatar angezeigt werden?',
'section' => 'login_settings',
'settings' => 'login_avatar_slider_speed',
'type' => 'number',
'input_attrs' => array( 'min' => 2, 'max' => 10, 'step' => 1 ),
) );
// =========================================================================
// === 8. EXPORT / IMPORT SECTION =========================================
// =========================================================================
$wp_customize->add_section( 'theme_mods_import_export', array(
'title' => __( 'Einstellungen sichern', 'minecraft-modern-theme' ),
'priority' => 999,
'description' => '',
) );
// Füge ein Custom Control mit HTML hinzu
$wp_customize->add_setting( 'import_export_placeholder', array(
'sanitize_callback' => 'sanitize_text_field',
) );
// Custom Control Class für Export/Import
class Import_Export_Control extends WP_Customize_Control {
public $type = 'import_export';
public function render_content() {
$export_url = admin_url('admin-post.php?action=export_theme_settings');
$nonce = wp_create_nonce('theme-import-nonce');
?>
<div class="import-export-wrapper" style="margin-top: 15px;">
<p class="description" style="margin-bottom: 20px;">
<strong>Hinweis:</strong> Hier kannst du alle deine Theme-Einstellungen sichern und wiederherstellen.
</p>
<a href="<?php echo esc_url($export_url); ?>" class="button button-primary button-hero" id="export-settings-btn" style="display: inline-flex; align-items: center; gap: 8px; margin-bottom: 20px;">
<span class="dashicons dashicons-download" style="margin-top:3px;"></span> Einstellungen Exportieren
</a>
<div style="border-top: 2px solid #ddd; padding-top: 20px; margin-top: 20px;">
<label style="display:block; margin-bottom:10px; font-weight:bold;">
Backup wiederherstellen:
</label>
<input type="file" id="import-settings-file" accept=".json" style="width:100%; margin-bottom:10px;">
<button type="button" class="button button-secondary" id="import-settings-btn" disabled style="display: inline-flex; align-items: center; gap: 8px;">
<span class="dashicons dashicons-upload" style="margin-top:3px;"></span> Einstellungen Importieren
</button>
</div>
<p class="description" style="margin-top:15px; padding: 10px; background: #fff3cd; border-left: 4px solid #ffc107;">
<strong>⚠️ Warnung:</strong> Beim Import werden alle aktuellen Einstellungen überschrieben!
</p>
</div>
<script type="text/javascript">
(function($) {
var ajaxUrl = '<?php echo admin_url('admin-ajax.php'); ?>';
var nonce = '<?php echo $nonce; ?>';
$('#import-settings-file').on('change', function() {
$('#import-settings-btn').prop('disabled', $(this).val() === '');
});
$('#import-settings-btn').on('click', function() {
var fileInput = $('#import-settings-file')[0];
if (fileInput.files.length === 0) {
alert('Bitte wähle eine JSON-Datei aus.');
return;
}
if (!confirm('WARNUNG: Alle aktuellen Einstellungen werden überschrieben. Bist du sicher?')) {
return;
}
var formData = new FormData();
formData.append('import_file', fileInput.files[0]);
formData.append('action', 'import_theme_settings');
formData.append('nonce', nonce);
var $btn = $(this);
var originalText = $btn.html();
$btn.prop('disabled', true).html('<span class="dashicons dashicons-update" style="margin-top:3px; animation: rotation 1s infinite linear;"></span> Importiere...');
$.ajax({
url: ajaxUrl,
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
if (response.success) {
alert('✅ ' + response.data);
location.reload();
} else {
alert('❌ Fehler: ' + response.data);
$btn.prop('disabled', false).html(originalText);
}
},
error: function() {
alert('❌ Ein technischer Fehler ist aufgetreten.');
$btn.prop('disabled', false).html(originalText);
}
});
});
})(jQuery);
</script>
<style>
@keyframes rotation {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
</style>
<?php
}
}
$wp_customize->add_control( new Import_Export_Control( $wp_customize, 'import_export_placeholder', array(
'section' => 'theme_mods_import_export',
) ) );
}
add_action( 'customize_register', 'minecraft_modern_customize_register' );
// =========================================================================
// === DYNAMISCHES CSS =====================================================
// =========================================================================
function minecraft_modern_dynamic_css_output() {
$accent_color = get_theme_mod( 'primary_accent_color', '#00d4ff' );
$slider_font = get_theme_mod( 'slider_font_family', 'Raleway' );
$slider_color = get_theme_mod( 'slider_font_color', '#ffffff' );
$slider_size_setting = get_theme_mod( 'slider_font_size', 'mittel' );
$header_height_setting = get_theme_mod( 'header_height', 'mittel' );
// Header-Höhe umwandeln
$header_height_value = '300px';
if ( $header_height_setting === 'klein' ) {
$header_height_value = '200px';
} elseif ( $header_height_setting === 'gross' ) {
$header_height_value = '400px';
}
// Schriftgrößen umwandeln
$font_sizes = array(
'klein' => array( 'title' => '2.5rem', 'subtitle' => '1.2rem' ),
'mittel' => array( 'title' => '3.5rem', 'subtitle' => '1.4rem' ),
'gross' => array( 'title' => '4.5rem', 'subtitle' => '1.6rem' ),
'extra-gross' => array( 'title' => '5.5rem', 'subtitle' => '1.8rem' ),
);
$chosen_sizes = isset( $font_sizes[$slider_size_setting] ) ? $font_sizes[$slider_size_setting] : $font_sizes['mittel'];
$fonts_to_load = array($slider_font);
$fonts_url = 'https://fonts.googleapis.com/css2?family=' . implode( ':wght@400;600;700&family=', $fonts_to_load ) . '&display=swap';
?>
<link rel="stylesheet" href="<?php echo esc_url($fonts_url); ?>">
<style type="text/css">
:root {
--primary-accent: <?php echo esc_attr($accent_color); ?>;
--header-height: <?php echo esc_attr($header_height_value); ?>;
}
.slider-title, .slider-subtitle, .hero-title, .hero-subtitle, .hero-button-1, .hero-button-2 {
font-family: '<?php echo esc_attr($slider_font); ?>', sans-serif;
color: <?php echo esc_attr($slider_color); ?>;
}
.slider-title, .hero-title {
font-size: <?php echo esc_attr($chosen_sizes['title']); ?>;
}
.slider-subtitle, .hero-subtitle {
font-size: <?php echo esc_attr($chosen_sizes['subtitle']); ?>;
}
/* Trennlinie unter dem Header */
.site-header {
border-bottom: 4px solid var(--primary-accent);
}
/* Trennlinie unter dem Slider */
.hero-slider {
border-bottom: 4px solid var(--primary-accent);
}
/* Trennlinie am oberen Rand des Footers */
.site-footer {
border-top: 4px solid var(--primary-accent);
}
</style>
<?php
}
add_action( 'wp_head', 'minecraft_modern_dynamic_css_output' );
// =========================================================================
// === THEME PRESET LOGIC (JAVASCRIPT) =====================================
// =========================================================================
/**
* Verbindet das Preset-Dropdown mit der Akzentfarbe-Einstellung.
* Sobald ein Preset gewählt wird, wird die Farbe im Customizer aktualisiert.
*/
function minecraft_preset_customize_js() {
?>
<script type="text/javascript">
(function($) {
// Definiere die Farben für die Presets
var presetColors = {
'classic': '#00d4ff', // Diamant Blau
'nether': '#ff3333', // Lava Rot
'end': '#aa00ff' // Ender Purpur
};
// Warten bis der Customizer bereit ist
wp.customize.bind('ready', function() {
// Listener für das Preset-Dropdown
wp.customize('theme_color_preset', function(setting) {
setting.bind(function(to) {
// Wenn eine Farbe für das gewählte Preset existiert...
if (presetColors[to]) {
// ...setze die Akzentfarbe auf diesen Wert.
// Das aktualisiert auch den Color Picker und die Live-Vorschau.
wp.customize('primary_accent_color').set(presetColors[to]);
}
});
});
});
})(jQuery);
</script>
<?php
}
add_action('customize_controls_print_footer_scripts', 'minecraft_preset_customize_js');