21 Commits
1.0 ... 1.2

Author SHA1 Message Date
aa07d5bda3 Dateien nach "Minecraft-Modern-Theme/js" hochladen 2025-11-30 13:27:52 +00:00
76218121a4 Minecraft-Modern-Theme/functions.php aktualisiert 2025-11-30 13:27:00 +00:00
04424d7f59 Minecraft-Modern-Theme/style.css aktualisiert 2025-11-30 13:26:45 +00:00
98640766c6 Minecraft-Modern-Theme/functions.php aktualisiert 2025-11-30 12:57:37 +00:00
3e911e5ab7 Minecraft-Modern-Theme/inc/customizer.php aktualisiert 2025-11-30 12:56:43 +00:00
036fa2be08 Dateien nach "Minecraft-Modern-Theme" hochladen 2025-11-30 12:56:19 +00:00
efdda0d8ed Dateien nach "Minecraft-Modern-Theme/js" hochladen 2025-11-30 12:55:55 +00:00
1b961d75bd Dateien nach "Minecraft-Modern-Theme/css" hochladen 2025-11-30 12:55:17 +00:00
8144180b8b Dateien nach "Minecraft-Modern-Theme-Child" hochladen 2025-11-29 21:56:27 +00:00
5a6a035fe1 Minecraft-Modern-Theme-Child/screenshot.PNG gelöscht 2025-11-29 21:56:14 +00:00
7cd7abdead Dateien nach "Minecraft-Modern-Theme" hochladen 2025-11-29 21:55:52 +00:00
e87c3f6f97 Minecraft-Modern-Theme/screenshot.PNG gelöscht 2025-11-29 21:55:29 +00:00
f25fbf3869 Minecraft-Modern-Theme/front-page.php aktualisiert 2025-11-29 21:55:18 +00:00
32bbb0b36f Minecraft-Modern-Theme/header.php aktualisiert 2025-11-29 21:55:05 +00:00
75af878db9 Minecraft-Modern-Theme/functions.php aktualisiert 2025-11-29 21:54:50 +00:00
88dd9e8c45 Minecraft-Modern-Theme/inc/customizer.php aktualisiert 2025-11-29 21:54:31 +00:00
5be3e02b7d Minecraft-Modern-Theme/js/slider-init.js aktualisiert 2025-11-29 21:54:01 +00:00
91df9b2f6f Minecraft-Modern-Theme/style.css aktualisiert 2025-11-29 21:53:34 +00:00
f9753124e1 README.md aktualisiert 2025-11-29 18:05:37 +00:00
4bfd56887c Dateien nach "Minecraft-Modern-Theme-Child" hochladen 2025-11-29 18:04:08 +00:00
12c762794b Dateien nach "Minecraft-Modern-Theme" hochladen 2025-11-29 18:03:50 +00:00
14 changed files with 2213 additions and 1278 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@@ -0,0 +1,229 @@
/* Minecraft Modern Theme Login Styles */
body.login {
background-color: #14151a; /* Fallback-Farbe */
background-size: cover;
background-position: center;
background-repeat: no-repeat;
font-family: 'Raleway', sans-serif;
}
/* Dunkler Overlay für bessere Lesbarkeit */
body.login::before {
content: '';
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(20, 21, 26, 0.8);
z-index: -1;
}
/* Logo zentrieren */
.login h1 {
text-align: center;
margin-bottom: 50px; /* ANGEPASST: Mehr Abstand für das größere Logo */
}
.login h1 a {
width: auto;
height: 160px; /* ANGEPASST: Logo ist jetzt doppelt so groß */
background-size: contain;
}
/* Haupt-Container, der alles umschließt */
#login {
width: 80%;
max-width: 800px;
margin: 0 auto;
padding: 0;
background: none;
box-shadow: none;
}
/* NEU: Der Wrapper, der vom Skript erstellt wird. Dies ist unsere "Tabelle". */
#login-content-wrapper {
display: flex;
align-items: stretch; /* Sorgt dafür, dass beide Spalten die gleiche Höhe haben */
background-color: #252830;
border-radius: 8px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
overflow: hidden; /* Sorgt für abgerundete Ecken an den Kind-Elementen */
}
/* Linke Spalte: Minecraft Avatar Slider (27.8%) */
#minecraft-avatar-slider {
flex: 0 0 27.8%; /* Feste Breite, wächst nicht, schrumpft nicht */
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
padding-top: 50px; /* ANGEPASST: Erzeugt den Raum, in den die Avatare verschoben werden */
background-color: #1a1c23; /* Leicht anderer Hintergrund für Kontrast */
height: auto; /* Höhe anpassen, damit sie nicht fest ist */
position: relative; /* Wichtig für den Slider */
overflow: hidden; /* Verhindert, dass Bilder überstehen */
}
#minecraft-avatar-slider .avatar-slide {
width: 100%;
height: auto; /* Seitenverhältnis beibehalten */
max-height: 400px; /* Maximale Höhe des Avatars, damit er nicht zu groß wird */
border-radius: 4px;
/* Slider-spezifische Stile */
position: absolute;
top: 25px; /* KORRIGIERT: Verschiebt alle Avatare um 50px nach unten */
left: 0;
opacity: 0;
transition: opacity 0.7s ease-in-out;
}
#minecraft-avatar-slider .avatar-slide-active {
opacity: 1;
}
/* Rechte Spalte: Login-Formular (72.2%) */
#loginform {
flex: 1; /* Nimmt den restlichen verfügbaren Platz ein */
padding: 40px;
background: none;
border: none;
box-shadow: none;
}
/* Formular-Felder */
#loginform p {
margin-bottom: 20px;
}
#loginform label {
color: #e4e4e4;
font-weight: 600;
display: block;
margin-bottom: 8px;
}
#loginform input[type="text"],
#loginform input[type="password"] {
width: 100%;
padding: 14px;
background-color: #1e2029;
border: 1px solid #333;
border-radius: 4px;
color: #e4e4e4;
font-family: 'Raleway', sans-serif;
font-size: 16px;
transition: border-color 0.3s, box-shadow 0.3s;
}
#loginform input[type="text"]:focus,
#loginform input[type="password"]:focus {
border-color: #00d4ff;
box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
outline: none;
}
/* Container für "Angemeldet bleiben" und "Passwort vergessen" */
.login-options-container {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 25px;
}
.login-options-container .forgetmenot,
.login-options-container #nav {
margin: 0; /* Entfernt Standard-Abstände */
}
.forgetmenot label {
font-weight: 400;
font-size: 14px;
color: #a0a0a0;
display: flex;
align-items: center;
}
.forgetmenot input[type="checkbox"] {
margin-right: 8px;
}
.login-options-container #nav a {
color: #a0a0a0;
text-decoration: none;
font-weight: 400;
font-size: 14px;
transition: color 0.2s;
}
.login-options-container #nav a:hover {
color: #00d4ff;
}
/* Submit-Button */
#loginform .submit input[type="submit"] {
width: 100%;
padding: 14px;
background-color: #00d4ff;
border: none;
border-radius: 4px;
color: #fff;
font-family: 'Raleway', sans-serif;
font-weight: 600;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s;
}
#loginform .submit input[type="submit"]:hover {
background-color: #00a8cc;
}
/* Anpassungen für kleinere Bildschirme */
@media screen and (max-width: 768px) {
#login-content-wrapper {
flex-direction: column; /* Spalten untereinander */
}
#minecraft-avatar-slider {
flex: none; /* Setzt Flexbox zurück */
width: 100%;
padding: 30px; /* Padding wird zurückgesetzt */
padding-top: 30px; /* Padding oben auch auf mobilen Geräten anpassen */
}
#minecraft-avatar-slider .avatar-slide {
max-height: 300px; /* Auf mobilen Geräten etwas kleiner */
max-width: 200px; /* Und auch schmaler */
top: 30px; /* WICHTIG: Auch hier den top-Wert anpassen! */
}
}
/* Fehlermeldungen und Hinweise */
.login .message, .login #login_error {
background-color: rgba(0, 212, 255, 0.1);
border-left: 4px solid #00d4ff;
padding: 15px;
margin-bottom: 20px;
border-radius: 0 4px 4px 0;
color: #e4e4e4;
}
/* =========================================================================
=== NEU: STIL FÜR DIE LINKS UNTER DEM ANMELDE-BUTTON ====================
========================================================================= */
.post-login-links {
display: flex;
justify-content: space-between; /* Verteilt die Links auf die ganze Breite */
align-items: center;
margin-top: 15px;
padding-top: 15px;
border-top: 1px solid #333; /* Trennlinie über den Links */
}
.post-login-links a {
color: #a0a0a0;
text-decoration: none;
font-size: 14px;
transition: color 0.2s ease;
}
.post-login-links a:hover {
color: #00d4ff;
}

View File

@@ -1,80 +1,92 @@
<?php get_header(); ?>
<?php
if ( get_theme_mod('slider_enabled', false) ) :
?>
<section class="hero-slider swiper-container">
<div class="swiper-wrapper">
<?php
for ($i = 1; $i <= 5; $i++) :
$image_url = get_theme_mod('slider_image_' . $i);
if ($image_url) :
$title = get_theme_mod('slider_title_' . $i);
$subtitle = get_theme_mod('slider_subtitle_' . $i);
?>
<div class="swiper-slide" style="background-image: url('<?php echo esc_url($image_url); ?>');">
<div class="slider-content">
<?php if ($title) : ?>
<h2 class="slider-title"><?php echo esc_html($title); ?></h2>
<?php endif; ?>
<?php if ($subtitle) : ?>
<p class="slider-subtitle"><?php echo esc_html($subtitle); ?></p>
<?php endif; ?>
</div>
</div>
<?php
endif;
endfor;
?>
</div>
<div class="swiper-pagination"></div>
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
</section>
<?php else : ?>
<?php
$hero_bg = get_theme_mod( 'hero_bg_image' );
$hero_title = get_theme_mod( 'hero_title', 'Willkommen auf unserem Server' );
$hero_subtitle = get_theme_mod( 'hero_subtitle', 'Trete einer Community voller Abenteuer bei.' );
$btn1_text = get_theme_mod( 'hero_button_1_text', 'Zum Forum' );
$btn1_url = get_theme_mod( 'hero_button_1_url', '#' );
$btn2_text = get_theme_mod( 'hero_button_2_text', 'Zum Teamspeak' );
$btn2_url = get_theme_mod( 'hero_button_2_url', '#' );
?>
<section class="hero-section" style="<?php echo $hero_bg ? "background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('" . esc_url($hero_bg) . "')" : ''; ?>">
<div class="container">
<h1 class="hero-title"><?php echo esc_html($hero_title); ?></h1>
<p class="hero-subtitle"><?php echo esc_html($hero_subtitle); ?></p>
<div class="hero-buttons">
<a href="<?php echo esc_url($btn1_url); ?>" class="hero-button-1"><?php echo esc_html($btn1_text); ?></a>
<a href="<?php echo esc_url($btn2_url); ?>" class="hero-button-2"><?php echo esc_html($btn2_text); ?></a>
</div>
</div>
</section>
<?php endif; ?>
<main id="primary" class="site-main">
<div class="container">
<div class="content-area">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('post'); ?>>
<?php if ( has_post_thumbnail() ) : ?>
<div class="post-thumbnail">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('medium_large'); ?></a>
</div>
<?php endif; ?>
<div class="post-content">
<h2 class="post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<div class="post-excerpt">
<?php the_excerpt(); ?>
</div>
</div>
</article>
<?php endwhile; else : ?>
<p><?php _e( 'Keine Beiträge gefunden.', 'minecraft-modern-theme' ); ?></p>
<?php endif; ?>
</div>
</div>
</main>
<?php get_header(); ?>
<?php
if ( get_theme_mod('slider_enabled', false) ) :
?>
<section class="hero-slider swiper-container">
<div class="swiper-wrapper">
<?php
for ($i = 1; $i <= 5; $i++) :
$image_url = get_theme_mod('slider_image_' . $i);
if ($image_url) :
$title = get_theme_mod('slider_title_' . $i);
$subtitle = get_theme_mod('slider_subtitle_' . $i);
?>
<div class="swiper-slide" style="background-image: url('<?php echo esc_url($image_url); ?>');">
<div class="slider-content">
<?php if ($title) : ?>
<h2 class="slider-title"><?php echo esc_html($title); ?></h2>
<?php endif; ?>
<?php if ($subtitle) : ?>
<p class="slider-subtitle"><?php echo esc_html($subtitle); ?></p>
<?php endif; ?>
</div>
</div>
<?php
endif;
endfor;
?>
</div>
<!-- Nur anzeigen, wenn die Paginierung NICHT ausgeblendet ist -->
<?php if ( ! get_theme_mod('slider_hide_pagination', false) ) : ?>
<div class="swiper-pagination"></div>
<?php endif; ?>
<!-- Nur anzeigen, wenn die Pfeile NICHT ausgeblendet sind -->
<?php if ( ! get_theme_mod('slider_hide_arrows', false) ) : ?>
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
<?php endif; ?>
</section>
<?php else : ?>
<?php
$hero_bg = get_theme_mod( 'hero_bg_image' );
$hero_title = get_theme_mod( 'hero_title', 'Willkommen auf unserem Server' );
$hero_subtitle = get_theme_mod( 'hero_subtitle', 'Trete einer Community voller Abenteuer bei.' );
$btn1_text = get_theme_mod( 'hero_button_1_text', 'Zum Forum' );
$btn1_url = get_theme_mod( 'hero_button_1_url', '#' );
$btn2_text = get_theme_mod( 'hero_button_2_text', 'Zum Teamspeak' );
$btn2_url = get_theme_mod( 'hero_button_2_url', '#' );
?>
<section class="hero-section" style="<?php echo $hero_bg ? "background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('" . esc_url($hero_bg) . "')" : ''; ?>">
<div class="container">
<h1 class="hero-title"><?php echo esc_html($hero_title); ?></h1>
<p class="hero-subtitle"><?php echo esc_html($hero_subtitle); ?></p>
<div class="hero-buttons">
<a href="<?php echo esc_url($btn1_url); ?>" class="hero-button-1"><?php echo esc_html($btn1_text); ?></a>
<a href="<?php echo esc_url($btn2_url); ?>" class="hero-button-2"><?php echo esc_html($btn2_text); ?></a>
</div>
</div>
</section>
<?php endif; ?>
<main id="primary" class="site-main">
<div class="container">
<div class="content-area">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('post'); ?>>
<?php if ( has_post_thumbnail() ) : ?>
<div class="post-thumbnail">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('medium_large'); ?></a>
</div>
<?php endif; ?>
<div class="post-content">
<h2 class="post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<!-- =================================================================== -->
<!-- === HIER IST DIE ÄNDERUNG: Vollen Inhalt anstelle des Auszugs === -->
<!-- =================================================================== -->
<div class="post-full-content">
<?php the_content(); ?>
</div>
</div>
</article>
<?php endwhile; else : ?>
<p><?php _e( 'Keine Beiträge gefunden.', 'minecraft-modern-theme' ); ?></p>
<?php endif; ?>
</div>
</div>
</main>
<?php get_footer(); ?>

View File

@@ -1,240 +1,417 @@
<?php
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// === Theme Setup ===
function minecraft_modern_setup() {
add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );
// Logo-Unterstützung aktivieren (Maximale Flexibilität)
add_theme_support( 'custom-logo', array(
'height' => 9999, // Sehr hohe Werte, um den Crop-Dialog zu umgehen
'width' => 9999, // Sehr hohe Werte, um den Crop-Dialog zu umgehen
'flex-height' => true,
'flex-width' => true,
'header-text' => array( 'site-title', 'site-description' ),
) );
// Benutzerdefinierten Hintergrund aktivieren
add_theme_support( 'custom-background' );
register_nav_menus( array(
'primary' => __( 'Hauptmenü', 'minecraft-modern-theme' ),
'footer' => __( 'Footer-Menü', 'minecraft-modern-theme' ),
) );
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );
}
add_action( 'after_setup_theme', 'minecraft_modern_setup' );
// === Styles & Scripts laden ===
function minecraft_modern_scripts() {
// Haupt-Stylesheet
wp_enqueue_style( 'minecraft-modern-style', get_stylesheet_uri() );
// Swiper.js CSS (von CDN)
wp_enqueue_style( 'swiper-css', 'https://cdn.jsdelivr.net/npm/swiper@8/swiper-bundle.min.css' );
// JavaScript für den Header-Scroll-Effekt
wp_enqueue_script(
'minecraft-modern-header-script',
get_template_directory_uri() . '/js/header-scroll.js',
array(),
'1.0',
true
);
// Swiper.js JS (von CDN)
wp_enqueue_script(
'swiper-js',
'https://cdn.jsdelivr.net/npm/swiper@8/swiper-bundle.min.js',
array(),
'8.0.0',
true
);
// Unsere eigene Slider-Initialisierungs-Datei
wp_enqueue_script(
'minecraft-modern-slider-script',
get_template_directory_uri() . '/js/slider-init.js',
array('swiper-js'), // Hängt von Swiper.js ab
'1.0',
true
);
// NEU: Theme-Toggle-Skript laden
wp_enqueue_script(
'theme-toggle-script',
get_template_directory_uri() . '/js/theme-toggle.js',
array(), // Keine Abhängigkeiten
'1.0',
true
);
// FAQ Skript laden, wenn der Post-Type aktiv ist
if ( post_type_exists('faq') ) {
wp_enqueue_script(
'faq-accordion-script',
get_template_directory_uri() . '/js/faq-accordion.js',
array(),
'1.0',
true
);
}
// Übergebe ALLE Theme-Einstellungen an das JavaScript
// KORREKTUR: Der Objektname muss 'sliderSettings' bleiben, damit slider-init.js funktioniert.
wp_localize_script(
'minecraft-modern-slider-script',
'sliderSettings',
array(
'hideArrows' => get_theme_mod( 'slider_hide_arrows', false ) ? '1' : '0',
'hidePagination' => get_theme_mod( 'slider_hide_pagination', false ) ? '1' : '0',
'defaultMode' => get_theme_mod( 'default_theme_mode', 'dark' ),
'ajax_url' => admin_url('admin-ajax.php')
)
);
// === NEU & WICHTIG: Header-Skript-Informationen übergeben ===
// Dies verhindert das Flackern im Customizer.
wp_localize_script(
'minecraft-modern-header-script', // <-- Richtiges Skript-Handle!
'headerSettings', // <-- Neuer Objektname für Klarheit
array(
'isCustomizer' => is_customize_preview()
)
);
}
add_action( 'wp_enqueue_scripts', 'minecraft_modern_scripts' );
// === Customizer-Datei laden ===
require get_template_directory() . '/inc/customizer.php';
// === Footer-Widgets registrieren ===
function minecraft_modern_footer_widgets() {
register_sidebar( array(
'name' => __( 'Footer Links', 'minecraft-modern-theme' ),
'id' => 'footer-left',
'description' => __( 'Widget-Bereich links im Footer.', 'minecraft-modern-theme' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title">',
'after_title' => '</h4>',
) );
for ( $i = 1; $i <= 3; $i++ ) {
register_sidebar( array(
'name' => sprintf( __( 'Footer Spalte %d', 'minecraft-modern-theme' ), $i ),
'id' => 'footer-' . $i,
'description' => sprintf( __( 'Widget für die %d. Spalte im Footer.', 'minecraft-modern-theme' ), $i ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title">',
'after_title' => '</h4>',
) );
}
register_sidebar( array(
'name' => __( 'Footer Rechts', 'minecraft-modern-theme' ),
'id' => 'footer-right',
'description' => __( 'Widget-Bereich rechts im Footer.', 'minecraft-modern-theme' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title">',
'after_title' => '</h4>',
) );
}
add_action( 'widgets_init', 'minecraft_modern_footer_widgets' );
// === FAQ Custom Post Type & Taxonomy ===
function create_faq_post_type() {
// Nur registrieren, wenn im Customizer aktiviert
if ( get_theme_mod( 'faq_enabled', true ) ) {
register_post_type('faq',
array(
'labels' => array(
'name' => __( 'FAQs', 'minecraft-modern-theme' ),
'singular_name' => __( 'FAQ', 'minecraft-modern-theme' ),
'add_new' => __( 'Neue FAQ hinzufügen', 'minecraft-modern-theme' ),
'add_new_item' => __( 'Neue FAQ hinzufügen', 'minecraft-modern-theme' ),
'edit_item' => __( 'FAQ bearbeiten', 'minecraft-modern-theme' ),
'new_item' => __( 'Neue FAQ', 'minecraft-modern-theme' ),
'view_item' => __( 'FAQ ansehen', 'minecraft-modern-theme' ),
'search_items' => __( 'FAQs durchsuchen', 'minecraft-modern-theme' ),
'not_found' => __( 'Keine FAQs gefunden', 'minecraft-modern-theme' ),
'not_found_in_trash' => __( 'Keine FAQs im Papierkorb gefunden', 'minecraft-modern-theme' ),
'all_items' => __( 'Alle FAQs', 'minecraft-modern-theme' ),
),
'public' => true,
'has_archive' => true, // Archiv-Seite /faq/ bleibt als Fallback
'menu_icon' => 'dashicons-format-chat',
'supports' => array( 'title', 'editor', 'page-attributes' ),
'rewrite' => array( 'slug' => 'faq' ),
'show_in_rest' => true,
)
);
register_taxonomy(
'faq_category',
'faq',
array(
'label' => __( 'FAQ Kategorien', 'minecraft-modern-theme' ),
'rewrite' => array( 'slug' => 'faq-kategorie' ),
'hierarchical' => true,
'show_in_rest' => true,
)
);
}
}
add_action('init', 'create_faq_post_type');
// =============================================================================
// NEU: Automatische FAQ-Seitenerstellung und Template-Zuweisung
// =============================================================================
/**
* Erstellt automatisch eine "FAQ" Seite, wenn die FAQ-Funktion aktiviert wird.
*/
function create_faq_page_automatically() {
// Prüfen, ob die FAQ-Funktion aktiv ist
if ( get_theme_mod( 'faq_enabled', true ) ) {
// Prüfen, ob die Seite bereits existiert
if ( get_page_by_title( 'FAQ' ) == null ) {
// Seite erstellen
$new_page = array(
'post_title' => 'FAQ',
'post_content' => 'Diese Seite zeigt alle FAQs an. Der Inhalt wird automatisch generiert.',
'post_status' => 'publish',
'post_type' => 'page',
'post_author' => 1,
);
// Seite in die Datenbank einfügen
wp_insert_post( $new_page );
}
}
}
// Diese Funktion wird ausgeführt, wenn der Customizer gespeichert wird.
add_action( 'customize_save_after', 'create_faq_page_automatically' );
/**
* Leitet Anfragen für die "FAQ" Seite auf unser spezielles Template um.
*/
function load_faq_page_template( $template ) {
// Prüfen, ob die FAQ-Funktion aktiv ist
if ( get_theme_mod( 'faq_enabled', true ) ) {
// Prüfen, ob wir uns auf einer Seite befinden
if ( is_page() ) {
global $post;
// Prüfen, ob der Titel der Seite "FAQ" ist
if ( $post && $post->post_title == 'FAQ' ) {
// Pfad zu unserem Template zurückgeben
return get_template_directory() . '/archive-faq.php';
}
}
}
// Standard-Template in allen anderen Fällen
return $template;
}
add_filter( 'template_include', 'load_faq_page_template' );
<?php
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// === Theme Setup ===
function minecraft_modern_setup() {
add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );
// Logo-Unterstützung aktivieren (Maximale Flexibilität)
add_theme_support( 'custom-logo', array(
'height' => 9999, // Sehr hohe Werte, um den Crop-Dialog zu umgehen
'width' => 9999, // Sehr hohe Werte, um den Crop-Dialog zu umgehen
'flex-height' => true,
'flex-width' => true,
'header-text' => array( 'site-title', 'site-description' ),
) );
// Benutzerdefinierten Hintergrund aktivieren
add_theme_support( 'custom-background' );
register_nav_menus( array(
'primary' => __( 'Hauptmenü', 'minecraft-modern-theme' ),
'footer' => __( 'Footer-Menü', 'minecraft-modern-theme' ),
) );
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );
}
add_action( 'after_setup_theme', 'minecraft_modern_setup' );
// === Styles & Scripts laden ===
function minecraft_modern_scripts() {
// Haupt-Stylesheet
wp_enqueue_style( 'minecraft-modern-style', get_stylesheet_uri() );
// Swiper.js CSS (von CDN)
wp_enqueue_style( 'swiper-css', 'https://cdn.jsdelivr.net/npm/swiper@8/swiper-bundle.min.css' );
// JavaScript für den Header-Scroll-Effekt
wp_enqueue_script(
'minecraft-modern-header-script',
get_template_directory_uri() . '/js/header-scroll.js',
array(),
'1.0',
true
);
// NEU: Ankündigungs-Skript laden
wp_enqueue_script(
'announcement-script',
get_template_directory_uri() . '/js/announcement.js',
array(), // Keine Abhängigkeiten
'1.0',
true
);
// Swiper.js JS (von CDN)
wp_enqueue_script(
'swiper-js',
'https://cdn.jsdelivr.net/npm/swiper@8/swiper-bundle.min.js',
array(),
'8.0.0',
true
);
// Unsere eigene Slider-Initialisierungs-Datei
wp_enqueue_script(
'minecraft-modern-slider-script',
get_template_directory_uri() . '/js/slider-init.js',
array('swiper-js'), // Hängt von Swiper.js ab
'1.0',
true
);
// NEU: Theme-Toggle-Skript laden
wp_enqueue_script(
'theme-toggle-script',
get_template_directory_uri() . '/js/theme-toggle.js',
array(), // Keine Abhängigkeiten
'1.0',
true
);
// FAQ Skript laden, wenn der Post-Type aktiv ist
if ( post_type_exists('faq') ) {
wp_enqueue_script(
'faq-accordion-script',
get_template_directory_uri() . '/js/faq-accordion.js',
array(),
'1.0',
true
);
}
// Übergebe ALLE Theme-Einstellungen an das JavaScript
wp_localize_script(
'minecraft-modern-slider-script',
'sliderSettings',
array(
'hideArrows' => get_theme_mod( 'slider_hide_arrows', false ) ? '1' : '0',
'hidePagination' => get_theme_mod( 'slider_hide_pagination', false ) ? '1' : '0',
'effect' => get_theme_mod( 'slider_effect', 'fade' ),
'direction' => get_theme_mod( 'slider_direction', 'horizontal' ),
'defaultMode' => get_theme_mod( 'default_theme_mode', 'dark' ),
'ajax_url' => admin_url('admin-ajax.php')
)
);
// === NEU & WICHTIG: Header-Skript-Informationen übergeben ===
// Dies verhindert das Flackern im Customizer.
wp_localize_script(
'minecraft-modern-header-script', // <-- Richtiges Skript-Handle!
'headerSettings', // <-- Neuer Objektname für Klarheit
array(
'isCustomizer' => is_customize_preview()
)
);
}
add_action( 'wp_enqueue_scripts', 'minecraft_modern_scripts' );
// === Customizer-Datei laden ===
require get_template_directory() . '/inc/customizer.php';
// === Footer-Widgets registrieren ===
function minecraft_modern_footer_widgets() {
register_sidebar( array(
'name' => __( 'Footer Links', 'minecraft-modern-theme' ),
'id' => 'footer-left',
'description' => __( 'Widget-Bereich links im Footer.', 'minecraft-modern-theme' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title">',
'after_title' => '</h4>',
) );
for ( $i = 1; $i <= 3; $i++ ) {
register_sidebar( array(
'name' => sprintf( __( 'Footer Spalte %d', 'minecraft-modern-theme' ), $i ),
'id' => 'footer-' . $i,
'description' => sprintf( __( 'Widget für die %d. Spalte im Footer.', 'minecraft-modern-theme' ), $i ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title">',
'after_title' => '</h4>',
) );
}
register_sidebar( array(
'name' => __( 'Footer Rechts', 'minecraft-modern-theme' ),
'id' => 'footer-right',
'description' => __( 'Widget-Bereich rechts im Footer.', 'minecraft-modern-theme' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title">',
'after_title' => '</h4>',
) );
}
add_action( 'widgets_init', 'minecraft_modern_footer_widgets' );
// === FAQ Custom Post Type & Taxonomy ===
function create_faq_post_type() {
// Nur registrieren, wenn im Customizer aktiviert
if ( get_theme_mod( 'faq_enabled', true ) ) {
register_post_type('faq',
array(
'labels' => array(
'name' => __( 'FAQs', 'minecraft-modern-theme' ),
'singular_name' => __( 'FAQ', 'minecraft-modern-theme' ),
'add_new' => __( 'Neue FAQ hinzufügen', 'minecraft-modern-theme' ),
'add_new_item' => __( 'Neue FAQ hinzufügen', 'minecraft-modern-theme' ),
'edit_item' => __( 'FAQ bearbeiten', 'minecraft-modern-theme' ),
'new_item' => __( 'Neue FAQ', 'minecraft-modern-theme' ),
'view_item' => __( 'FAQ ansehen', 'minecraft-modern-theme' ),
'search_items' => __( 'FAQs durchsuchen', 'minecraft-modern-theme' ),
'not_found' => __( 'Keine FAQs gefunden', 'minecraft-modern-theme' ),
'not_found_in_trash' => __( 'Keine FAQs im Papierkorb gefunden', 'minecraft-modern-theme' ),
'all_items' => __( 'Alle FAQs', 'minecraft-modern-theme' ),
),
'public' => true,
'has_archive' => true, // Archiv-Seite /faq/ bleibt als Fallback
'menu_icon' => 'dashicons-format-chat',
'supports' => array( 'title', 'editor', 'page-attributes' ),
'rewrite' => array( 'slug' => 'faq' ),
'show_in_rest' => true,
)
);
register_taxonomy(
'faq_category',
'faq',
array(
'label' => __( 'FAQ Kategorien', 'minecraft-modern-theme' ),
'rewrite' => array( 'slug' => 'faq-kategorie' ),
'hierarchical' => true,
'show_in_rest' => true,
)
);
}
}
add_action('init', 'create_faq_post_type');
// =============================================================================
// NEU: Automatische "Home" Seitenerstellung und Zuweisung (kombiniert)
// =============================================================================
/**
* Erstellt die "Home" Seite und weist sie automatisch als statische Startseite zu,
* wenn das Theme aktiviert wird und noch keine Seite festgelegt ist.
*/
function set_static_front_page_automatically() {
// Nur ausführen, wenn noch keine statische Seite als Startseite festgelegt ist
if ( 'page' !== get_option( 'show_on_front' ) ) {
// Finde die "Home" Seite (oder erstelle sie, falls sie nicht existiert)
$home_page = get_page_by_title( 'Home' );
if ( ! $home_page ) {
// Seite erstellen, falls sie nicht existiert
$home_page_id = wp_insert_post( array(
'post_title' => 'Home',
'post_content' => 'Diese Seite dient als statische Startseite.',
'post_status' => 'publish',
'post_type' => 'page',
'post_author' => 1,
) );
} else {
$home_page_id = $home_page->ID;
}
// Setze die Seite als statische Startseite
if ( $home_page_id ) {
update_option( 'show_on_front', 'page' );
update_option( 'page_on_front', $home_page_id );
}
}
}
add_action( 'after_switch_theme', 'set_static_front_page_automatically' );
/**
* Fügt eine Body-Klasse hinzu, um den Home-Titel per CSS auszublenden.
*/
function add_home_body_class( $classes ) {
// Prüfen, ob wir auf der Startseite sind und die Einstellung zum Ausblenden aktiv ist
if ( is_front_page() && !get_theme_mod( 'show_home_title', true ) ) {
$classes[] = 'home-title-hidden';
}
return $classes;
}
add_filter( 'body_class', 'add_home_body_class' );
// =============================================================================
// Automatische FAQ-Seitenerstellung und Template-Zuweisung
// =============================================================================
/**
* Erstellt automatisch eine "FAQ" Seite, wenn die FAQ-Funktion aktiviert wird.
*/
function create_faq_page_automatically() {
// Prüfen, ob die FAQ-Funktion aktiv ist
if ( get_theme_mod( 'faq_enabled', true ) ) {
// Prüfen, ob die Seite bereits existiert
if ( get_page_by_title( 'FAQ' ) == null ) {
// Seite erstellen
$new_page = array(
'post_title' => 'FAQ',
'post_content' => 'Diese Seite zeigt alle FAQs an. Der Inhalt wird automatisch generiert.',
'post_status' => 'publish',
'post_type' => 'page',
'post_author' => 1,
);
// Seite in die Datenbank einfügen
wp_insert_post( $new_page );
}
}
}
// Diese Funktion wird ausgeführt, wenn der Customizer gespeichert wird.
add_action( 'customize_save_after', 'create_faq_page_automatically' );
/**
* Leitet Anfragen für die "FAQ" Seite auf unser spezielles Template um.
*/
function load_faq_page_template( $template ) {
// Prüfen, ob die FAQ-Funktion aktiv ist
if ( get_theme_mod( 'faq_enabled', true ) ) {
// Prüfen, ob wir uns auf einer Seite befinden
if ( is_page() ) {
global $post;
// Prüfen, ob der Titel der Seite "FAQ" ist
if ( $post && $post->post_title == 'FAQ' ) {
// Pfad zu unserem Template zurückgeben
return get_template_directory() . '/archive-faq.php';
}
}
}
// Standard-Template in allen anderen Fällen
return $template;
}
add_filter( 'template_include', 'load_faq_page_template' );
// =========================================================================
// === CUSTOM LOGIN FUNCTIONS (KOMPLETT NEU & KORRIGIERT) ==========
// =========================================================================
// Lädt alle notwendigen Styles und Scripts nur für die Login-Seite
function minecraft_modern_login_assets() {
// Lade die Login-spezifische CSS
wp_enqueue_style('minecraft-modern-login-style', get_template_directory_uri() . '/css/login-style.css');
// Lade Font Awesome für Icons
wp_enqueue_style('font-awesome', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css');
// Lade das JavaScript für den Avatar-Slider
wp_enqueue_script('minecraft-avatar-slider-script', get_template_directory_uri() . '/js/login-slider.js', array('jquery'), '1.0', true);
// Lade das JavaScript, das die HTML-Struktur anpasst
wp_enqueue_script('minecraft-modern-login-script', get_template_directory_uri() . '/js/login-script.js', array('jquery'), '1.0', true);
wp_add_inline_script('minecraft-modern-login-script', "
jQuery(document).ready(function($) {
$('.forgetmenot, #nav').wrapAll('<div class=\"login-options-container\"></div>');
});
");
// Übergebe die Slider-Geschwindigkeit aus dem Customizer an das JavaScript
$slider_speed = get_theme_mod('login_avatar_slider_speed', 4); // Standard: 4 Sekunden
wp_localize_script('minecraft-avatar-slider-script', 'avatarSliderSettings', array(
'speed' => $slider_speed * 1000 // Umwandlung in Millisekunden für JS
));
// Hintergrundbild und Logo als Inline-CSS hinzufügen
$login_bg_image = get_theme_mod('login_background_image');
if ($login_bg_image) {
$custom_css = "body.login { background-image: url('{$login_bg_image}') !important; }";
wp_add_inline_style('minecraft-modern-login-style', $custom_css);
}
$logo_url = get_theme_mod('login_logo');
if ($logo_url) {
$logo_css = ".login h1 a { background-image: url('{$logo_url}') !important; }";
wp_add_inline_style('minecraft-modern-login-style', $logo_css);
}
}
add_action('login_enqueue_scripts', 'minecraft_modern_login_assets');
// Erstellt die HTML-Struktur für den Avatar-Slider
function add_minecraft_avatar_slider_to_login() {
$avatar_html = '<div id="minecraft-avatar-slider">';
$has_avatars = false;
// Durchlaufe alle 5 möglichen Avatar-Plätze
for ($i = 1; $i <= 5; $i++) {
$uuid = get_theme_mod('login_avatar_uuid_' . $i);
if (!empty($uuid)) {
$has_avatars = true;
$avatar_url = "https://visage.surgeplay.com/full/{$uuid}.png";
// Das erste Bild wird direkt angezeigt
$active_class = ($i === 1) ? 'avatar-slide-active' : '';
$avatar_html .= '<img class="avatar-slide ' . esc_attr($active_class) . '" src="' . esc_url($avatar_url) . '" alt="Minecraft Avatar ' . ($i + 1) . '">';
}
}
$avatar_html .= '</div>';
// Nur den Slider ausgeben, wenn mindestens ein Avatar hinterlegt wurde
if ($has_avatars) {
echo $avatar_html;
}
}
add_action('login_form', 'add_minecraft_avatar_slider_to_login');
function add_post_login_links() {
?>
<div class="post-login-links">
<a href="<?php echo esc_url(home_url()); ?>">&larr; Zu <?php bloginfo('name'); ?></a>
</div>
<?php
}
add_action('login_form_bottom', 'add_post_login_links');
// Entfernt unnötige Elemente von der Login-Seite
function customize_login_page() {
add_filter('login_display_language_dropdown', '__return_false');
add_filter('login_display_back_to_blog', '__return_false');
}
add_action('login_head', 'customize_login_page');
// Passt Login-URL und Titel an
function custom_login_url() { return home_url(); }
add_filter('login_headerurl', 'custom_login_url');
function custom_login_title() { return get_bloginfo('name'); }
add_filter('login_headertext', 'custom_login_title');
// =========================================================================
// === SCROLL TO TOP BUTTON ===============================================
// =========================================================================
// Fügt den HTML-Code für den Button zum Footer hinzu
function add_scroll_to_top_button() {
?>
<a href="#" id="scroll-to-top" title="Nach oben scrollen">
<i class="fas fa-chevron-up"></i>
</a>
<?php
}
add_action('wp_footer', 'add_scroll_to_top_button');
// Lädt das JavaScript für den Scroll-to-Top Button
function minecraft_modern_scroll_to_top_script() {
wp_enqueue_script(
'minecraft-scroll-to-top-script',
get_template_directory_uri() . '/js/scroll-to-top.js',
array('jquery'),
'1.0',
true
);
}
add_action('wp_enqueue_scripts', 'minecraft_modern_scroll_to_top_script');

View File

@@ -1,67 +1,65 @@
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<header id="masthead" class="site-header">
<div class="container">
<div class="header-main">
<div class="site-branding">
<?php
// Zeigt das Logo an, wenn eines vorhanden ist.
if ( function_exists( 'the_custom_logo' ) && has_custom_logo() ) {
the_custom_logo();
}
?>
<?php
// Zeigt den Titel der Website IMMER an.
// Verwendet <h1> auf der Startseite, sonst <p> für bessere SEO.
if ( is_front_page() && is_home() ) :
?>
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<?php else : ?>
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
<?php endif; ?>
</div>
<nav id="site-navigation" class="main-navigation">
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'container' => false ) ); ?>
</nav>
<div class="header-info">
<div class="social-links">
<?php
// Array mit den Social-Media-Plattformen und ihren Font Awesome Klassen
$social_icons = array(
'discord' => 'fab fa-discord',
'youtube' => 'fab fa-youtube',
'twitter' => 'fab fa-x-twitter', // Neues Icon für Twitter/X
'facebook' => 'fab fa-facebook-f',
'instagram' => 'fab fa-instagram',
'tiktok' => 'fab fa-tiktok',
'twitch' => 'fab fa-twitch',
'steam' => 'fab fa-steam',
'github' => 'fab fa-github',
'linkedin' => 'fab fa-linkedin-in',
'pinterest' => 'fab fa-pinterest-p',
'reddit' => 'fab fa-reddit-alien',
'teamspeak' => 'fab fa-teamspeak',
'spotify' => 'fab fa-spotify'
);
// Schleife, die alle verfügbaren Icons durchgeht
foreach ($social_icons as $key => $class) {
// Prüfen, ob für diese Plattform eine URL im Customizer hinterlegt wurde
if (get_theme_mod('social_' . $key)) {
// Wenn ja, Link und Icon ausgeben
echo '<a href="' . esc_url(get_theme_mod('social_' . $key)) . '" target="_blank"><i class="' . esc_attr($class) . '"></i></a>';
}
}
?>
</div>
</div>
</div>
</div>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<header id="masthead" class="site-header">
<div class="container">
<div class="header-main">
<div class="site-branding">
<?php
if ( function_exists( 'the_custom_logo' ) && has_custom_logo() ) {
the_custom_logo();
}
?>
<?php
if ( is_front_page() && is_home() ) :
?>
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<?php else : ?>
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
<?php endif; ?>
</div>
<nav id="site-navigation" class="main-navigation">
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'container' => false ) ); ?>
</nav>
<div class="header-info">
<div class="social-links">
<?php
// Array mit den Social-Media-Plattformen und ihren Font Awesome Klassen
$social_icons = array(
'discord' => 'fab fa-discord',
'youtube' => 'fab fa-youtube',
'twitter' => 'fab fa-x-twitter', // Neues Icon für Twitter/X
'facebook' => 'fab fa-facebook-f',
'instagram' => 'fab fa-instagram',
'tiktok' => 'fab fa-tiktok',
'twitch' => 'fab fa-twitch',
'steam' => 'fab fa-steam',
'github' => 'fab fa-github',
'linkedin' => 'fab fa-linkedin-in',
'pinterest' => 'fab fa-pinterest-p',
'reddit' => 'fab fa-reddit-alien',
'teamspeak' => 'fab fa-teamspeak',
'spotify' => 'fab fa-spotify'
);
// Schleife, die alle verfügbaren Icons durchgeht
foreach ($social_icons as $key => $class) {
// Prüfen, ob für diese Plattform eine URL im Customizer hinterlegt wurde
if (get_theme_mod('social_' . $key)) {
// Wenn ja, Link und Icon ausgeben
echo '<a href="' . esc_url(get_theme_mod('social_' . $key)) . '" target="_blank"><i class="' . esc_attr($class) . '"></i></a>';
}
}
?>
</div>
</div>
</div>
</div>
</header>

View File

@@ -1,258 +1,354 @@
<?php
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',
) ) );
// === 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' => '&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',
) );
// =========================================================================
// === 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';
?>
<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']); ?>;
}
</style>
<?php
}
add_action( 'wp_head', 'minecraft_modern_dynamic_css_output' );
<?php
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',
) ) );
// === 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',
) );
// =========================================================================
// === NEU: Slider-Effekt-Einstellungen ===================================
// =========================================================================
$wp_customize->add_setting( 'slider_effect', array( 'default' => 'fade', 'sanitize_callback' => 'sanitize_key' ) );
$wp_customize->add_control( 'slider_effect', array(
'label' => 'Slider-Effekt', 'section' => 'header_slider', 'settings' => 'slider_effect', 'type' => 'select',
'choices' => array( 'slide' => 'Horizontales Gleiten', 'fade' => 'Überblenden', 'cube' => 'Würfel-Effekt' ),
) );
$wp_customize->add_setting( 'slider_direction', array( 'default' => 'horizontal', 'sanitize_callback' => 'sanitize_key' ) );
$wp_customize->add_control( 'slider_direction', array(
'label' => 'Slider-Richtung (nur für "Gleiten")', 'section' => 'header_slider', 'settings' => 'slider_direction', 'type' => 'select',
'choices' => array( 'horizontal' => 'Horizontal', 'vertical' => 'Vertikal' ),
) );
// --- 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' => '&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',
) );
// =========================================================================
// === 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',
) );
// =========================================================================
// === 6. 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 ),
) );
}
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' ); // 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';
?>
<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']); ?>;
}
/* =================================================================== */
/* === NEU: Trennlinien mit der Akzentfarbe ========================= */
/* =================================================================== */
/* 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' );

View File

@@ -0,0 +1,19 @@
jQuery(document).ready(function($) {
// Warte, bis das DOM vollständig geladen ist
// Wir erstellen einen Wrapper um den Avatar-Slider und das Formular, um das Flexbox-Layout zu ermöglichen.
const avatar = $('#minecraft-avatar-slider');
const form = $('#loginform');
// Nur ausführen, wenn beide Elemente existieren
if (avatar.length && form.length) {
// Erstelle einen neuen Wrapper-Div
const wrapper = $('<div id="login-content-wrapper"></div>');
// Füge den Wrapper vor dem Formular in den #login Container ein
form.before(wrapper);
// Verschiebe den Avatar-Slider und das Formular in den Wrapper
wrapper.append(avatar);
wrapper.append(form);
}
});

View File

@@ -0,0 +1,25 @@
jQuery(document).ready(function($) {
const slider = $('#minecraft-avatar-slider');
const slides = slider.find('.avatar-slide');
// Nur starten, wenn es mehr als einen Slide gibt
if (slides.length > 1) {
let currentIndex = 0;
function showSlide(index) {
slides.removeClass('avatar-slide-active');
slides.eq(index).addClass('avatar-slide-active');
}
function nextSlide() {
currentIndex = (currentIndex + 1) % slides.length;
showSlide(currentIndex);
}
// Geschwindigkeit aus den WordPress-Einstellungen holen
const speed = avatarSliderSettings.speed || 4000;
// Den Slider alle X Sekunden wechseln
setInterval(nextSlide, speed);
}
});

View File

@@ -0,0 +1,30 @@
jQuery(document).ready(function($) {
// Wähle den Button aus
var scrollButton = $('#scroll-to-top');
// Funktion zum Anzeigen oder Verstecken des Buttons
function toggleScrollButton() {
// Wenn mehr als 300px gescrollt wurde, zeige den Button
if ($(window).scrollTop() > 300) {
scrollButton.addClass('show');
} else {
scrollButton.removeClass('show');
}
}
// Event Listener für das Scrollen
$(window).on('scroll', function() {
toggleScrollButton();
});
// Event Listener für den Klick auf den Button
scrollButton.on('click', function(e) {
// Verhindere das Standardverhalten des Links
e.preventDefault();
// Scrolle die Seite sanft nach oben
$('html, body').animate({
scrollTop: 0
}, 800); // 800ms für eine sanfte Animation
});
});

View File

@@ -1,55 +1,65 @@
document.addEventListener('DOMContentLoaded', function() {
// Hole den Slider-Container
const heroSlider = document.querySelector('.hero-slider');
// Stelle sicher, dass der Slider auf der Seite existiert, bevor du versuchst, ihn zu konfigurieren
if (!heroSlider) {
return;
}
// Konfiguration für den Slider vorbereiten
const swiperConfig = {
// Optionen für den Slider
loop: true, // Endloses Schleifen
// Autoplay
autoplay: {
delay: 5000, // 5 Sekunden pro Slide
disableOnInteraction: false, // Autoplay nicht nach Klick stoppen
},
// Wenn der Nutzer die Maus darüber bewegt, pausieren
pauseOnMouseEnter: true,
// Effekt
effect: 'fade', // Übergangseffekt: 'slide', 'fade', 'cube', etc.
fadeEffect: {
crossFade: true
}
};
// Prüfe, ob die Pfeile ausgeblendet werden sollen
if (sliderSettings.hideArrows === '1') {
heroSlider.classList.add('slider-hide-arrows');
} else {
// Navigation nur hinzufügen, wenn sie nicht ausgeblendet wird
swiperConfig.navigation = {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
};
}
// Prüfe, ob die Paginierung ausgeblendet werden soll
if (sliderSettings.hidePagination === '1') {
heroSlider.classList.add('slider-hide-pagination');
} else {
// Pagination nur hinzufügen, wenn sie nicht ausgeblendet wird
swiperConfig.pagination = {
el: '.swiper-pagination',
clickable: true, // Klick auf Punkt springt zum Slide
};
}
// Initialisiere den Slider mit der konfigurierten Optionen
new Swiper('.hero-slider', swiperConfig);
});
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<header id="masthead" class="site-header">
<div class="container">
<div class="header-main">
<div class="site-branding">
<?php
if ( function_exists( 'the_custom_logo' ) && has_custom_logo() ) {
the_custom_logo();
}
?>
<?php
if ( is_front_page() && is_home() ) :
?>
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<?php else : ?>
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
<?php endif; ?>
</div>
<nav id="site-navigation" class="main-navigation">
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'container' => false ) ); ?>
</nav>
<div class="header-info">
<div class="social-links">
<?php
// Array mit den Social-Media-Plattformen und ihren Font Awesome Klassen
$social_icons = array(
'discord' => 'fab fa-discord',
'youtube' => 'fab fa-youtube',
'twitter' => 'fab fa-x-twitter', // Neues Icon für Twitter/X
'facebook' => 'fab fa-facebook-f',
'instagram' => 'fab fa-instagram',
'tiktok' => 'fab fa-tiktok',
'twitch' => 'fab fa-twitch',
'steam' => 'fab fa-steam',
'github' => 'fab fa-github',
'linkedin' => 'fab fa-linkedin-in',
'pinterest' => 'fab fa-pinterest-p',
'reddit' => 'fab fa-reddit-alien',
'teamspeak' => 'fab fa-teamspeak',
'spotify' => 'fab fa-spotify'
);
// Schleife, die alle verfügbaren Icons durchgeht
foreach ($social_icons as $key => $class) {
// Prüfen, ob für diese Plattform eine URL im Customizer hinterlegt wurde
if (get_theme_mod('social_' . $key)) {
// Wenn ja, Link und Icon ausgeben
echo '<a href="' . esc_url(get_theme_mod('social_' . $key)) . '" target="_blank"><i class="' . esc_attr($class) . '"></i></a>';
}
}
?>
</div>
</div>
</div>
</div>
</header>

View File

@@ -0,0 +1,208 @@
<?php
/*
Template Name: Minecraft Modern Theme
*/
get_header(); ?>
<div class="container">
<div id="primary" class="content-area">
<main id="main" class="site-main">
<div class="custom-login-container">
<?php
// Wenn der Benutzer nicht angemeldet ist, zeige das Login-Formular
if (!is_user_logged_in()) {
// Custom Login Formular
$args = array(
'echo' => true,
'redirect' => admin_url(), // Weiterleitung zum Dashboard nach dem Login
'form_id' => 'custom_loginform',
'label_username' => __( 'Benutzername' ),
'label_password' => __( 'Passwort' ),
'label_remember' => __( 'Angemeldet bleiben' ),
'label_log_in' => __( 'Anmelden' ),
'id_username' => 'user_login',
'id_password' => 'user_pass',
'id_remember' => 'rememberme',
'id_submit' => 'wp-submit',
'remember' => true,
'value_username' => NULL,
'value_remember' => false
);
// Minecraft Avatar Container
$avatar_uuid = get_theme_mod('login_avatar_uuid', '069a79f444e94726a5befca90e38eaf6');
if (!empty($avatar_uuid)) {
// === KORRIGIERT: Nutzen wir nun Minotar.net für den VOLLKÖRPER ===
$avatar_url = "https://minotar.net/full/{$avatar_uuid}/256";
echo '<div id="minecraft-avatar-container"><img src="' . esc_url($avatar_url) . '" alt="Minecraft Avatar"></div>';
}
// Login-Formular anzeigen
wp_login_form($args);
} else {
// Wenn der Benutzer bereits angemeldet ist, zeige eine Nachricht und einen Logout-Link
$current_user = wp_get_current_user();
echo '<div class="logged-in-message">';
echo '<h2>Willkommen zurück, ' . esc_html($current_user->display_name) . '!</h2>';
echo '<p>Du bist bereits angemeldet.</p>';
echo '<p><a href="' . esc_url(wp_logout_url(home_url())) . '" class="button">Abmelden</a></p>';
echo '<p><a href="' . esc_url(admin_url()) . '" class="button">Zum Dashboard</a></p>';
echo '</div>';
}
?>
</div>
</main>
</div>
</div>
<?php
// Login-Hintergrundbild aus dem Customizer holen und als Inline-CSS ausgeben
$login_bg_image = get_theme_mod('login_background_image');
if ($login_bg_image):
?>
<style>
body {
background-image: url('<?php echo esc_url($login_bg_image); ?>') !important;
background-size: cover !important;
background-position: center !important;
background-repeat: no-repeat !important;
}
body::before {
content: '';
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(20, 21, 26, 0.8);
z-index: -1;
}
</style>
<?php endif; ?>
<style>
.custom-login-container {
max-width: 800px;
margin: 60px auto;
padding: 40px;
background-color: var(--card-bg, #252830);
border-radius: 8px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
border: 1px solid var(--border-color, #333);
display: flex;
align-items: center;
gap: 40px;
}
#minecraft-avatar-container {
flex: 0 0 27.8%;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
background-color: #1a1c23;
height: auto;
}
#minecraft-avatar-container img {
width: 100%;
height: auto;
max-height: 400px;
border-radius: 4px;
border: 3px solid var(--primary-accent, #00d4ff);
box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
}
#custom_loginform {
flex: 1;
}
#custom_loginform p {
margin-bottom: 20px;
}
#custom_loginform label {
display: block;
margin-bottom: 8px;
font-weight: 600;
color: var(--text-color, #e4e4e4);
}
#custom_loginform input[type="text"],
#custom_loginform input[type="password"] {
width: 100%;
padding: 14px;
background-color: var(--surface-color, #1e2029);
border: 1px solid var(--border-color, #333);
border-radius: 4px;
color: var(--text-color, #e4e4e4);
font-family: 'Raleway', sans-serif;
}
#custom_loginform .forgetmenot label {
display: inline-flex;
align-items: center;
font-weight: 400;
}
#custom_loginform .submit {
margin-top: 10px;
}
#custom_loginform input[type="submit"] {
width: 100%;
padding: 14px;
background-color: var(--primary-accent, #00d4ff);
border: none;
border-radius: 4px;
color: #fff;
font-weight: 600;
cursor: pointer;
transition: background-color 0.3s;
}
#custom_loginform input[type="submit"]:hover {
background-color: #00a8cc;
}
.logged-in-message {
text-align: center;
padding: 40px;
}
.logged-in-message h2 {
margin-top: 0;
color: var(--primary-accent, #00d4ff);
}
.logged-in-message .button {
display: inline-block;
margin: 10px;
padding: 12px 25px;
background-color: var(--primary-accent, #00d4ff);
color: #fff;
text-decoration: none;
border-radius: 4px;
font-weight: 600;
transition: background-color 0.3s;
}
.logged-in-message .button:hover {
background-color: #00a8cc;
}
@media screen and (max-width: 768px) {
.custom-login-container {
flex-direction: column;
gap: 30px;
}
#minecraft-avatar-container {
width: 100%;
}
#minecraft-avatar-container img {
max-height: 300px;
max-width: 200px;
}
}
</style>
<?php get_footer(); ?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

File diff suppressed because it is too large Load Diff

View File

@@ -1,2 +1 @@
# Minecraft-Modern-Theme
<img src="https://git.viper.ipv64.net/M_Viper/Minecraft-Modern-Theme/raw/branch/main/Minecraft-Modern-Theme/screenshot.PNG" alt="Backend" width="100%">