diff --git a/Minecraft-Modern-Theme/inc/customizer.php b/Minecraft-Modern-Theme/inc/customizer.php new file mode 100644 index 0000000..168d0dd --- /dev/null +++ b/Minecraft-Modern-Theme/inc/customizer.php @@ -0,0 +1,258 @@ +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', + ) ) ); + + // === VERGESSENE EINSTELLUNG WIEDER HINZUGEFÜGT === + $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' ) ); + + + // ========================================================================= + // === 2. FARBEN & DARSTELLUNG (KOMBINIERT) ================================ + // ========================================================================= + + // --- Sektion: Farben & Darstellung --- + $wp_customize->add_section( 'theme_appearance_settings', array( + 'title' => 'Farben & Darstellung', + 'priority' => 30, + ) ); + + // 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. 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', + ) ); + } + + + // ========================================================================= + // === 4. FOOTER-BEREICH ================================================== + // ========================================================================= + + $wp_customize->add_section( 'footer_settings', array( 'title' => 'Footer-Einstellungen', 'priority' => 50 ) ); + + // Copyright-Text + $wp_customize->add_setting( 'footer_copyright', array( 'default' => '© ' . 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', + ) ); + + + // ========================================================================= + // === 5. 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', + ) ); + +} +add_action( 'customize_register', 'minecraft_modern_customize_register' ); + + +// ========================================================================= +// === DYNAMISCHES CSS ===================================================== +// ========================================================================= + +// Diese Funktion bleibt unverändert, da sie bereits gut strukturiert ist. +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' ); // Diese Einstellung wird hier verwendet! + + // 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'; + ?> + + + +