23 Commits
1.5 ... main

Author SHA1 Message Date
c7e8703787 Minecraft-Modern-Theme/inc/theme-updater.php aktualisiert 2026-01-09 21:55:21 +00:00
39f1d87475 Minecraft-Modern-Theme/functions.php aktualisiert 2026-01-09 21:31:50 +00:00
ae3795337e Minecraft-Modern-Theme/style.css aktualisiert 2026-01-09 20:48:41 +00:00
43be3dd783 Upload style.css via GUI 2026-01-09 19:45:51 +00:00
afcabb0f10 Upload single-faq.php via GUI 2026-01-09 19:45:51 +00:00
99e9d76c97 Upload single.php via GUI 2026-01-09 19:45:50 +00:00
91586b8cee Upload page-login.php via GUI 2026-01-09 19:45:48 +00:00
156030f70d Upload page.php via GUI 2026-01-09 19:45:48 +00:00
603cc0a430 Upload index.php via GUI 2026-01-09 19:45:47 +00:00
23b93ec177 Upload header.php via GUI 2026-01-09 19:45:47 +00:00
839b1a2e85 Upload functions.php via GUI 2026-01-09 19:45:46 +00:00
b0d7f44d9a Upload front-page.php via GUI 2026-01-09 19:45:46 +00:00
fab5f1464c Upload footer.php via GUI 2026-01-09 19:45:45 +00:00
6b8301bff5 Upload dynamic-styles.php via GUI 2026-01-09 19:45:45 +00:00
a316e6a6dd Upload file archive-team.php via GUI 2026-01-09 20:45:43 +01:00
d334704927 Upload archive-faq.php via GUI 2026-01-09 19:45:35 +00:00
5004c0072c Update from Git Manager GUI 2026-01-09 20:45:33 +01:00
250d00aa20 Update from Git Manager GUI 2026-01-09 20:45:31 +01:00
519c7c6b52 Minecraft-Modern-Theme/header.php aktualisiert 2026-01-07 21:09:20 +00:00
8499b29174 Minecraft-Modern-Theme/style.css aktualisiert 2026-01-07 21:09:00 +00:00
b62c52cfad Minecraft-Modern-Theme/inc/theme-updater.php aktualisiert 2026-01-06 23:19:18 +00:00
57e758353a Minecraft-Modern-Theme/inc/customizer.php aktualisiert 2026-01-06 23:18:59 +00:00
ae4ec1dc30 Minecraft-Modern-Theme/functions.php aktualisiert 2026-01-06 23:18:47 +00:00
11 changed files with 2259 additions and 515 deletions

View File

@@ -0,0 +1,47 @@
<?php get_header(); ?>
<div class="container site-main">
<div class="content-area">
<div class="team-archive-container">
<header class="page-header">
<h1 class="page-title">Unser Team</h1>
<p class="page-description">Lerne die Leute kennen, die diesen Server am Laufen halten.</p>
</header>
<?php
$query = new WP_Query(array('post_type' => 'team_member', 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC'));
if ( $query->have_posts() ) : ?>
<div class="team-grid">
<?php while ( $query->have_posts() ) : $query->the_post();
$rank_string = get_post_meta( get_the_ID(), '_team_member_rank', true );
$img = get_the_post_thumbnail_url( get_the_ID(), 'medium' );
if ( !$img ) $img = get_template_directory_uri() . '/images/default-avatar.png';
?>
<article class="team-card">
<div class="team-image-wrapper">
<img src="<?php echo esc_url($img); ?>" alt="<?php echo esc_attr(get_the_title()); ?>">
</div>
<div class="team-info">
<h3 class="team-name"><?php the_title(); ?></h3>
<div class="team-ranks-wrapper">
<?php if ( !empty($rank_string) ) {
$ranks = explode(',', $rank_string);
foreach ( $ranks as $r ) {
echo '<span class="team-rank">' . esc_html(trim($r)) . '</span>';
}
} ?>
</div>
<div class="team-bio"><?php the_excerpt(); ?></div>
</div>
</article>
<?php endwhile; ?>
</div>
<?php wp_reset_postdata(); ?>
<?php else : ?>
<p>Noch keine Teammitglieder.</p>
<?php endif; ?>
</div>
</div>
</div>
<?php get_footer(); ?>

View File

@@ -1,103 +1,103 @@
<footer id="colophon" class="site-footer"> <footer id="colophon" class="site-footer">
<div class="container"> <div class="container">
<!-- 1. OBERER BEREICH: Widgets --> <!-- 1. OBERER BEREICH: Widgets -->
<div class="footer-widgets"> <div class="footer-widgets">
<?php if ( is_active_sidebar( 'footer-1' ) ) : ?> <?php if ( is_active_sidebar( 'footer-1' ) ) : ?>
<div class="footer-widget"><?php dynamic_sidebar( 'footer-1' ); ?></div> <div class="footer-widget"><?php dynamic_sidebar( 'footer-1' ); ?></div>
<?php endif; ?> <?php endif; ?>
<?php if ( is_active_sidebar( 'footer-2' ) ) : ?> <?php if ( is_active_sidebar( 'footer-2' ) ) : ?>
<div class="footer-widget"><?php dynamic_sidebar( 'footer-2' ); ?></div> <div class="footer-widget"><?php dynamic_sidebar( 'footer-2' ); ?></div>
<?php endif; ?> <?php endif; ?>
<?php if ( is_active_sidebar( 'footer-3' ) ) : ?> <?php if ( is_active_sidebar( 'footer-3' ) ) : ?>
<div class="footer-widget"><?php dynamic_sidebar( 'footer-3' ); ?></div> <div class="footer-widget"><?php dynamic_sidebar( 'footer-3' ); ?></div>
<?php endif; ?> <?php endif; ?>
</div> </div>
<!-- 2. UNTERER BEREICH: Menü, Copyright, Legal --> <!-- 2. UNTERER BEREICH: Menü, Copyright, Legal -->
<div class="footer-bottom-bar"> <div class="footer-bottom-bar">
<div class="footer-left-group"> <div class="footer-left-group">
<!-- Copyright --> <!-- Copyright -->
<div class="site-info"> <div class="site-info">
<?php <?php
$copyright_text = get_theme_mod( 'footer_copyright', '&copy; ' . date('Y') . ' ' . get_bloginfo('name') ); $copyright_text = get_theme_mod( 'footer_copyright', '&copy; ' . date('Y') . ' ' . get_bloginfo('name') );
if ( get_theme_mod('show_footer_credit', true) ) { if ( get_theme_mod('show_footer_credit', true) ) {
$full_footer_text = $copyright_text . ' <span class="footer-separator">|</span> <span class="footer-credit"> $full_footer_text = $copyright_text . ' <span class="footer-separator">|</span> <span class="footer-credit">
<a href="https://m-viper.de" target="_blank" rel="noopener noreferrer"> <a href="https://m-viper.de" target="_blank" rel="noopener noreferrer">
Minecraft Theme by M_Viper Minecraft Theme by M_Viper
</a> </a>
</span>'; </span>';
} else { } else {
$full_footer_text = $copyright_text; $full_footer_text = $copyright_text;
} }
echo '<p>' . wp_kses_post( $full_footer_text ) . '</p>'; echo '<p>' . wp_kses_post( $full_footer_text ) . '</p>';
?> ?>
</div> </div>
<!-- Footer Menü ( falls vorhanden ) --> <!-- Footer Menü ( falls vorhanden ) -->
<?php if ( has_nav_menu( 'footer' ) ) : ?> <?php if ( has_nav_menu( 'footer' ) ) : ?>
<nav class="footer-navigation"> <nav class="footer-navigation">
<?php <?php
wp_nav_menu( wp_nav_menu(
array( array(
'theme_location' => 'footer', 'theme_location' => 'footer',
'menu_class' => 'footer-menu', 'menu_class' => 'footer-menu',
'container' => false, 'container' => false,
'depth' => 1, // Nur eine Ebene 'depth' => 1, // Nur eine Ebene
) )
); );
?> ?>
</nav> </nav>
<?php endif; ?> <?php endif; ?>
</div> </div>
<div class="footer-right-group"> <div class="footer-right-group">
<!-- Impressum & Datenschutz --> <!-- Impressum & Datenschutz -->
<div class="footer-legal-links"> <div class="footer-legal-links">
<?php <?php
$impressum_url = get_theme_mod('footer_impressum_url'); $impressum_url = get_theme_mod('footer_impressum_url');
$datenschutz_url = get_theme_mod('footer_datenschutz_url'); $datenschutz_url = get_theme_mod('footer_datenschutz_url');
$links = array(); $links = array();
if (!empty($impressum_url)) { if (!empty($impressum_url)) {
$links[] = '<a href="' . esc_url($impressum_url) . '"><i class="fas fa-info-circle"></i> Impressum</a>'; $links[] = '<a href="' . esc_url($impressum_url) . '"><i class="fas fa-info-circle"></i> Impressum</a>';
} }
if (!empty($datenschutz_url)) { if (!empty($datenschutz_url)) {
$links[] = '<a href="' . esc_url($datenschutz_url) . '"><i class="fas fa-shield-alt"></i> Datenschutz</a>'; $links[] = '<a href="' . esc_url($datenschutz_url) . '"><i class="fas fa-shield-alt"></i> Datenschutz</a>';
} }
if (!empty($links)) { if (!empty($links)) {
echo implode('', $links); // Kein Trennzeichen mehr, da wir Icons haben echo implode('', $links); // Kein Trennzeichen mehr, da wir Icons haben
} }
?> ?>
</div> </div>
</div> </div>
</div> <!-- Ende footer-bottom-bar --> </div> <!-- Ende footer-bottom-bar -->
</div> <!-- Ende Container --> </div> <!-- Ende Container -->
<!-- THEME TOGGLE (Fixiert unten rechts) --> <!-- THEME TOGGLE (Fixiert unten rechts) -->
<button class="theme-toggle" aria-label="Dark/Light Mode umschalten" title="Dark / Light Mode"> <button class="theme-toggle" aria-label="Dark/Light Mode umschalten" title="Dark / Light Mode">
<div class="theme-toggle-icons"> <div class="theme-toggle-icons">
<svg class="icon-moon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg class="icon-moon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/> <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
</svg> </svg>
<svg class="icon-sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg class="icon-sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="5"/> <circle cx="12" cy="12" r="5"/>
<line x1="12" y1="1" x2="12" y2="3"/> <line x1="12" y1="1" x2="12" y2="3"/>
<line x1="12" y1="21" x2="12" y2="23"/> <line x1="12" y1="21" x2="12" y2="23"/>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/> <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/> <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/>
<line x1="1" y1="12" x2="3" y2="12"/> <line x1="1" y1="12" x2="3" y2="12"/>
<line x1="21" y1="12" x2="23" y2="12"/> <line x1="21" y1="12" x2="23" y2="12"/>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/> <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/> <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
</svg> </svg>
</div> </div>
</button> </button>
</footer> </footer>
<?php wp_footer(); ?> <?php wp_footer(); ?>
</body> </body>
</html> </html>

View File

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

View File

@@ -16,7 +16,7 @@ function minecraft_modern_setup() {
'width' => 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-height' => true,
'flex-width' => true, 'flex-width' => true,
'header-text' => array( 'site-title', 'site-description' ), 'header_text' => array( 'site-title', 'site-description' ),
) ); ) );
// Benutzerdefinierten Hintergrund aktivieren // Benutzerdefinierten Hintergrund aktivieren
@@ -61,7 +61,7 @@ function minecraft_modern_scripts() {
'announcement-script', 'announcement-script',
get_template_directory_uri() . '/js/announcement.js', get_template_directory_uri() . '/js/announcement.js',
array(), // Keine Abhängigkeiten array(), // Keine Abhängigkeiten
'1.0', '1.3', // Version angehoben für Countdown Update
true true
); );
@@ -425,4 +425,930 @@ function minecraft_modern_scroll_to_top_script() {
true true
); );
} }
add_action('wp_enqueue_scripts', 'minecraft_modern_scroll_to_top_script'); add_action('wp_enqueue_scripts', 'minecraft_modern_scroll_to_top_script');
// =============================================================================
// === THEME SETTINGS EXPORT / IMPORT (VOLLSTÄNDIG KORRIGIERT) ===============
// =============================================================================
// 1. Export Handler (Download) - ALLE EINSTELLUNGEN
add_action( 'admin_post_export_theme_settings', 'handle_theme_settings_export' );
function handle_theme_settings_export() {
// Sicherheitscheck
if ( ! current_user_can( 'edit_theme_options' ) ) {
wp_die( __( 'Du hast keine Berechtigung, diese Aktion auszuführen.', 'minecraft-modern-theme' ) );
}
// Theme Slug ermitteln
$theme_slug = get_option( 'stylesheet' );
// 1. Theme Mods (Customizer-Einstellungen) holen
$mods = get_theme_mods();
// 2. Announcement Settings manuell hinzufügen
$announcement_keys = array(
'mm_announcement_enabled',
'mm_announcement_text',
'mm_announcement_bg',
'mm_announcement_color',
'mm_announcement_font_size',
'mm_announcement_font_family',
'mm_announcement_position',
'mm_announcement_countdown_enabled',
'mm_announcement_countdown_label',
'mm_announcement_countdown_date',
'mm_announcement_countdown_expired_msg'
);
foreach ( $announcement_keys as $key ) {
$mods[$key] = get_option($key);
}
// 3. Team Daten holen
$team_data = array();
$team_query = new WP_Query(array(
'post_type' => 'team_member',
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC'
));
if ( $team_query->have_posts() ) {
while ( $team_query->have_posts() ) {
$team_query->the_post();
$team_data[] = array(
'title' => get_the_title(),
'content' => get_the_content(),
'rank' => get_post_meta( get_the_ID(), '_team_member_rank', true ),
'menu_order' => get_post_field( 'menu_order', get_the_ID() ),
);
}
wp_reset_postdata(); // WICHTIG: Post-Daten zurücksetzen
}
$mods['team_data'] = $team_data;
// Daten als JSON vorbereiten
$data = json_encode( $mods, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE );
// Header für Download setzen
header( 'Content-Type: application/json; charset=utf-8' );
header( 'Content-Disposition: attachment; filename=' . $theme_slug . '-settings-' . date( 'Y-m-d' ) . '.json' );
header( 'Pragma: no-cache' );
header( 'Expires: 0' );
echo $data;
exit;
}
// 2. Import Handler (AJAX) - ALLE EINSTELLUNGEN
add_action( 'wp_ajax_import_theme_settings', 'handle_theme_settings_import' );
function handle_theme_settings_import() {
// Sicherheitscheck & Nonce
if ( ! current_user_can( 'edit_theme_options' ) ) {
wp_send_json_error( __( 'Keine Berechtigung.', 'minecraft-modern-theme' ) );
}
check_ajax_referer( 'theme-import-nonce', 'nonce' );
if ( empty( $_FILES['import_file']['tmp_name'] ) ) {
wp_send_json_error( __( 'Keine Datei hochgeladen.', 'minecraft-modern-theme' ) );
}
// Datei einlesen
$file = $_FILES['import_file']['tmp_name'];
$json_content = file_get_contents( $file );
$data = json_decode( $json_content, true );
// JSON validieren
if ( json_last_error() !== JSON_ERROR_NONE || ! is_array( $data ) ) {
wp_send_json_error( __( 'Die hochgeladene Datei ist keine gültige JSON-Datei.', 'minecraft-modern-theme' ) );
}
// Announcement Keys definieren
$announcement_keys = array(
'mm_announcement_enabled',
'mm_announcement_text',
'mm_announcement_bg',
'mm_announcement_color',
'mm_announcement_font_size',
'mm_announcement_font_family',
'mm_announcement_position',
'mm_announcement_countdown_enabled',
'mm_announcement_countdown_label',
'mm_announcement_countdown_date',
'mm_announcement_countdown_expired_msg'
);
// KRITISCHER FIX: Team Daten VORHER extrahieren und aus Array entfernen
$team_data = isset($data['team_data']) ? $data['team_data'] : array();
unset($data['team_data']); // Verhindert Fehler beim Durchlaufen der Theme Mods
// 1. Theme Mods & Announcement importieren
foreach ( $data as $mod_key => $mod_value ) {
// Unterscheidung: Announcement = Option, Rest = Theme Mod
if ( in_array( $mod_key, $announcement_keys ) ) {
update_option( $mod_key, $mod_value );
} else {
set_theme_mod( $mod_key, $mod_value );
}
}
// 2. Team Daten importieren
if ( ! empty( $team_data ) ) {
// Vorherige Team-Mitglieder löschen (Clean Import)
$existing_team = new WP_Query(array(
'post_type' => 'team_member',
'posts_per_page' => -1,
'fields' => 'ids'
));
if ( $existing_team->have_posts() ) {
foreach ( $existing_team->posts as $post_id ) {
wp_delete_post( $post_id, true ); // true = permanent löschen
}
}
wp_reset_postdata(); // WICHTIG: Post-Daten zurücksetzen
// Neue Mitglieder anlegen
foreach ( $team_data as $member ) {
$new_id = wp_insert_post(array(
'post_title' => sanitize_text_field( $member['title'] ),
'post_content' => sanitize_textarea_field( $member['content'] ),
'post_type' => 'team_member',
'post_status' => 'publish',
'menu_order' => isset( $member['menu_order'] ) ? intval( $member['menu_order'] ) : 0
));
if ( $new_id && ! is_wp_error( $new_id ) ) {
// Rang als Meta-Data speichern
if ( isset( $member['rank'] ) ) {
update_post_meta( $new_id, '_team_member_rank', sanitize_text_field( $member['rank'] ) );
}
}
}
}
wp_send_json_success( __( 'Einstellungen und Team erfolgreich importiert! Bilder müssen ggf. neu hochgeladen werden.', 'minecraft-modern-theme' ) );
}
/*
* -------------------------------------------------------------------------
* Announcement Bar (Admin + Frontend) vollständiges Modul mit Font-Vorschau & Countdown
* -------------------------------------------------------------------------
*/
/**
* Liste verfügbarer Fonts (Label, CSS-Family, Google-Flag, Google-Name)
*/
function mm_announcement_get_font_list() {
return array(
'inherit' => array('label' => 'Theme-Standard', 'css' => 'inherit', 'google' => false, 'google_name' => ''),
'Arial' => array('label' => 'Arial', 'css' => 'Arial, Helvetica, sans-serif', 'google' => false, 'google_name' => ''),
'Roboto' => array('label' => 'Roboto', 'css' => "'Roboto', sans-serif", 'google' => true, 'google_name' => 'Roboto'),
'Montserrat' => array('label' => 'Montserrat', 'css' => "'Montserrat', sans-serif", 'google' => true, 'google_name' => 'Montserrat'),
'Open Sans' => array('label' => 'Open Sans', 'css' => "'Open Sans', sans-serif", 'google' => true, 'google_name' => 'Open+Sans'),
'Lato' => array('label' => 'Lato', 'css' => "'Lato', sans-serif", 'google' => true, 'google_name' => 'Lato'),
'Poppins' => array('label' => 'Poppins', 'css' => "'Poppins', sans-serif", 'google' => true, 'google_name' => 'Poppins'),
'Source Sans Pro' => array('label' => 'Source Sans Pro', 'css' => "'Source Sans Pro', sans-serif", 'google' => true, 'google_name' => 'Source+Sans+Pro'),
'Noto Sans' => array('label' => 'Noto Sans', 'css' => "'Noto Sans', sans-serif", 'google' => true, 'google_name' => 'Noto+Sans'),
'Raleway' => array('label' => 'Raleway', 'css' => "'Raleway', sans-serif", 'google' => true, 'google_name' => 'Raleway'),
'Merriweather' => array('label' => 'Merriweather', 'css' => "'Merriweather', serif", 'google' => true, 'google_name' => 'Merriweather'),
'Playfair Display' => array('label' => 'Playfair Display', 'css' => "'Playfair Display', serif", 'google' => true, 'google_name' => 'Playfair+Display'),
'Oswald' => array('label' => 'Oswald', 'css' => "'Oswald', sans-serif", 'google' => true, 'google_name' => 'Oswald'),
'Rubik' => array('label' => 'Rubik', 'css' => "'Rubik', sans-serif", 'google' => true, 'google_name' => 'Rubik'),
'Inter' => array('label' => 'Inter', 'css' => "'Inter', sans-serif", 'google' => true, 'google_name' => 'Inter'),
'Nunito' => array('label' => 'Nunito', 'css' => "'Nunito', sans-serif", 'google' => true, 'google_name' => 'Nunito'),
'Ubuntu' => array('label' => 'Ubuntu', 'css' => "'Ubuntu', sans-serif", 'google' => true, 'google_name' => 'Ubuntu'),
'PT Sans' => array('label' => 'PT Sans', 'css' => "'PT Sans', sans-serif", 'google' => true, 'google_name' => 'PT+Sans'),
'Archivo' => array('label' => 'Archivo', 'css' => "'Archivo', sans-serif", 'google' => true, 'google_name' => 'Archivo'),
'Fira Sans' => array('label' => 'Fira Sans', 'css' => "'Fira Sans', sans-serif", 'google' => true, 'google_name' => 'Fira+Sans'),
'Work Sans' => array('label' => 'Work Sans', 'css' => "'Work Sans', sans-serif", 'google' => true, 'google_name' => 'Work+Sans'),
'Quicksand' => array('label' => 'Quicksand', 'css' => "'Quicksand', sans-serif", 'google' => true, 'google_name' => 'Quicksand'),
'Karla' => array('label' => 'Karla', 'css' => "'Karla', sans-serif", 'google' => true, 'google_name' => 'Karla'),
// Script / Schreibschrift
'Dancing Script' => array('label' => 'Dancing Script', 'css' => "'Dancing Script', cursive", 'google' => true, 'google_name' => 'Dancing+Script'),
'Pacifico' => array('label' => 'Pacifico', 'css' => "'Pacifico', cursive", 'google' => true, 'google_name' => 'Pacifico'),
'Great Vibes' => array('label' => 'Great Vibes', 'css' => "'Great Vibes', cursive", 'google' => true, 'google_name' => 'Great+Vibes'),
'Satisfy' => array('label' => 'Satisfy', 'css' => "'Satisfy', cursive", 'google' => true, 'google_name' => 'Satisfy'),
'Allura' => array('label' => 'Allura', 'css' => "'Allura', cursive", 'google' => true, 'google_name' => 'Allura'),
'Alex Brush' => array('label' => 'Alex Brush', 'css' => "'Alex Brush', cursive", 'google' => true, 'google_name' => 'Alex+Brush'),
'Cookie' => array('label' => 'Cookie', 'css' => "'Cookie', cursive", 'google' => true, 'google_name' => 'Cookie'),
);
}
/* ------------------ Admin: Einstellungen & Menü ------------------ */
function mm_announcement_admin_init() {
add_menu_page(
'Ankündigung',
'Ankündigung',
'manage_options',
'mm-announcement',
'mm_announcement_admin_page',
'dashicons-megaphone',
61
);
register_setting('mm_announcement_group', 'mm_announcement_enabled');
register_setting('mm_announcement_group', 'mm_announcement_text');
register_setting('mm_announcement_group', 'mm_announcement_bg');
register_setting('mm_announcement_group', 'mm_announcement_color');
register_setting('mm_announcement_group', 'mm_announcement_font_size');
register_setting('mm_announcement_group', 'mm_announcement_font_family');
register_setting('mm_announcement_group', 'mm_announcement_position');
// --- NEU: Countdown Timer Settings ---
register_setting('mm_announcement_group', 'mm_announcement_countdown_enabled');
register_setting('mm_announcement_group', 'mm_announcement_countdown_label');
register_setting('mm_announcement_group', 'mm_announcement_countdown_date');
register_setting('mm_announcement_group', 'mm_announcement_countdown_expired_msg');
}
add_action('admin_menu', 'mm_announcement_admin_init');
/* ------------------ Admin: Seite (mit Font-Select & Vorschau) ------------------ */
function mm_announcement_admin_page() {
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
$fonts = mm_announcement_get_font_list();
$selected_font = get_option('mm_announcement_font_family', 'inherit');
$selected_size = (int) get_option('mm_announcement_font_size', 16 );
$bg = esc_attr( get_option('mm_announcement_bg', '#1e1e1e') );
$color = esc_attr( get_option('mm_announcement_color', '#ffffff') );
$text_sample = wp_strip_all_tags( get_option('mm_announcement_text') ) ?: 'Das ist eine Vorschau: Wie sieht die Schrift aus?';
?>
<div class="wrap mm-announcement-admin">
<h1>Header-Ankündigung</h1>
<p class="description">
Diese Leiste wird auf allen Seiten angezeigt. Die Vorschau unten zeigt sofort, wie die Ankündigung aussieht — Änderungen im Editor oder an den Design-Feldern wirken <strong>direkt in der Vorschau</strong>, erst wenn du auf <em>Änderungen speichern</em> klickst, werden die Einstellungen im Frontend übernommen.
</p>
<form method="post" action="options.php" id="mm-announcement-form">
<?php settings_fields('mm_announcement_group'); ?>
<h2>Allgemein</h2>
<table class="form-table">
<tr>
<th>Aktivieren</th>
<td>
<label>
<input type="checkbox" name="mm_announcement_enabled" value="1" <?php checked(1, get_option('mm_announcement_enabled')); ?>>
Ankündigung anzeigen
</label>
<p class="description">Wenn deaktiviert, wird die Leiste nicht angezeigt.</p>
</td>
</tr>
</table>
<h2>Inhalt</h2>
<table class="form-table">
<tr>
<th style="vertical-align: top;">Text</th>
<td>
<?php
// wp_editor mit ID mm_announcement_text (wichtig für JS)
wp_editor(
get_option('mm_announcement_text'),
'mm_announcement_text',
array(
'textarea_rows' => 6,
'media_buttons' => false,
'tinymce' => true,
'quicktags' => true,
)
);
?>
<!-- ========================= -->
<!-- Icon-Hilfe unter Editor -->
<!-- ========================= -->
<h3>Verfügbare Icons</h3>
<p class="description">Diese Icons kannst du direkt im Ankündigungstext verwenden. Klicke auf ein Icon, um es in den Editor einzufügen.</p>
<div id="mm-announcement-icon-list" style="display:flex; flex-wrap:wrap; gap:10px; margin-bottom:20px;">
<?php
// Liste der Symbole (Unicode / Emoji)
$icons = array('⚡', '‼️', '❗', '✅', '❌', '⭐', '🔥', '💡', '📢', '🎮', '🏆', '🔔', '🎉', '💬', '🛡️');
foreach($icons as $icon) {
echo '<button type="button" class="mm-icon-button" style="
font-size:20px;
padding:6px 10px;
border:1px solid #ccc;
border-radius:4px;
background:#f7f7f7;
cursor:pointer;
" title="Klicke zum Einfügen">'.$icon.'</button>';
}
?>
</div>
<script type="text/javascript">
jQuery(document).ready(function($){
$('#mm-announcement-icon-list .mm-icon-button').on('click', function(){
var icon = $(this).text();
// TinyMCE-Editor einfügen
if (typeof(tinymce) !== 'undefined') {
var editor = tinymce.get('mm_announcement_text');
if(editor) {
editor.execCommand('mceInsertContent', false, icon);
return;
}
}
// Fallback: normale Textarea
var textarea = $('#mm_announcement_text');
var start = textarea[0].selectionStart;
var end = textarea[0].selectionEnd;
var text = textarea.val();
textarea.val(text.substring(0, start) + icon + text.substring(end));
// Cursor nach eingefügtem Icon setzen
textarea[0].selectionStart = textarea[0].selectionEnd = start + icon.length;
textarea.focus();
});
});
</script>
<p class="description">HTML erlaubt (z. B. &lt;a&gt;-Links). Änderungen hier erscheinen sofort in der Vorschau — sie werden aber erst nach "Änderungen speichern" im Frontend übernommen.</p>
<!-- Vorschau direkt unter dem Editor (JETZT IM GLEICHEN TD) -->
<div id="mm-announcement-preview"
style="background: <?php echo $bg; ?>; color: <?php echo $color; ?>; padding: 12px; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); margin-top: 14px;">
<div id="mm-announcement-preview-text"
style="font-size: <?php echo $selected_size; ?>px; font-family: <?php
$fonts = mm_announcement_get_font_list();
$key = $selected_font;
echo isset($fonts[$key]) ? esc_attr( $fonts[$key]['css'] ) : 'inherit';
?>; text-align:center;">
<?php
// Für Vorschau den reinen Text anzeigen (HTML gestrippt)
echo esc_html( $text_sample );
?>
</div>
<p style="margin-top:10px; color:#888; font-size:13px; text-align:center;">
Live Vorschau
</p>
</div>
<!-- / Vorschau -->
</td>
</tr>
</table>
<h2>Position</h2>
<table class="form-table">
<tr>
<th>Anzeigeort</th>
<td>
<select name="mm_announcement_position" id="mm-announcement-position">
<option value="top" <?php selected(get_option('mm_announcement_position'), 'top'); ?>>Ganz oben (über dem Header)</option>
<option value="below-header" <?php selected(get_option('mm_announcement_position'), 'below-header'); ?>>Unter dem Header (Standard für Seiten ohne Slider)</option>
</select>
<p class="description">Wähle die Position für die Anzeige. Die Vorschau zeigt die Position optisch — tatsächliche Frontend-Platzierung erfolgt nach Speichern.</p>
</td>
</tr>
</table>
<h2>Design</h2>
<table class="form-table">
<tr>
<th>Hintergrundfarbe</th>
<td><input type="color" name="mm_announcement_bg" id="mm-announcement-bg" value="<?php echo $bg; ?>"></td>
</tr>
<tr>
<th>Textfarbe</th>
<td><input type="color" name="mm_announcement_color" id="mm-announcement-color" value="<?php echo $color; ?>"></td>
</tr>
<tr>
<th>Schriftgröße (px)</th>
<td><input type="number" min="10" max="48" name="mm_announcement_font_size" id="mm-announcement-size" value="<?php echo $selected_size; ?>"></td>
</tr>
<tr>
<th>Schriftfamilie</th>
<td>
<select name="mm_announcement_font_family" id="mm-announcement-font">
<?php foreach ( $fonts as $key => $f ) : ?>
<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $selected_font, $key ); ?>>
<?php echo esc_html( $f['label'] ); ?>
</option>
<?php endforeach; ?>
</select>
<p class="description">Wähle eine Schriftart. Die Vorschau lädt Google-Fonts automatisch für die Vorschau an (nur im Admin).</p>
</td>
</tr>
</table>
<!-- NEU: Countdown Timer Sektion -->
<h2>Countdown Timer</h2>
<table class="form-table">
<tr>
<th>Countdown aktivieren</th>
<td>
<label>
<input type="checkbox" name="mm_announcement_countdown_enabled" value="1" <?php checked(1, get_option('mm_announcement_countdown_enabled')); ?>>
Timer im Banner anzeigen
</label>
<p class="description">Zeigt einen Countdown neben dem Ankündigungstext an.</p>
</td>
</tr>
<tr>
<th>Label (Text vor dem Timer)</th>
<td>
<input type="text" name="mm_announcement_countdown_label" value="<?php echo esc_attr(get_option('mm_announcement_countdown_label', 'Event in:')); ?>" style="width: 100%;">
<p class="description">z.B. "Server Restart in:"</p>
</td>
</tr>
<tr>
<th>Zieldatum & Uhrzeit</th>
<td>
<input type="datetime-local" name="mm_announcement_countdown_date" value="<?php echo esc_attr(get_option('mm_announcement_countdown_date')); ?>">
<p class="description">Wähle das Datum und die Uhrzeit (lokale Server-Zeit).</p>
</td>
</tr>
<tr>
<th>Nachricht nach Ablauf</th>
<td>
<input type="text" name="mm_announcement_countdown_expired_msg" value="<?php echo esc_attr(get_option('mm_announcement_countdown_expired_msg', 'Event läuft gerade!')); ?>" style="width: 100%;">
<p class="description">Text, der angezeigt wird, wenn der Countdown bei 0 ist.</p>
</td>
</tr>
</table>
<?php submit_button('Änderungen speichern'); ?>
</form>
</div>
<?php
}
/* ------------------ Frontend: Render (global, via wp_body_open) ------------------ */
function mm_render_announcement_bar() {
if ( ! get_option('mm_announcement_enabled') ) {
return;
}
// Countdown Einstellungen holen
$countdown_enabled = get_option('mm_announcement_countdown_enabled', false);
$countdown_label = esc_attr(get_option('mm_announcement_countdown_label', 'Event in:'));
$countdown_date = esc_attr(get_option('mm_announcement_countdown_date', ''));
$countdown_expired = esc_html(get_option('mm_announcement_countdown_expired_msg', 'Event läuft gerade!'));
// sichere Werte aus Optionen
$position = esc_attr( get_option( 'mm_announcement_position', 'below-header' ) );
$bg = esc_attr( get_option( 'mm_announcement_bg', '#1e1e1e' ) );
$color = esc_attr( get_option( 'mm_announcement_color', '#ffffff' ) );
$size = (int) get_option( 'mm_announcement_font_size', 16 );
$font_key = get_option( 'mm_announcement_font_family', 'inherit' );
$fonts = mm_announcement_get_font_list();
$font_css = isset( $fonts[ $font_key ] ) ? $fonts[ $font_key ]['css'] : 'inherit';
$text = get_option( 'mm_announcement_text', '' );
// Escaping
$font_css_esc = wp_strip_all_tags( $font_css );
$text_kses = wp_kses_post( $text );
// Countdown HTML Container
$countdown_html = '';
if ($countdown_enabled && !empty($countdown_date)) {
$countdown_html = '<div class="mm-countdown-wrapper" style="display:inline-flex; align-items:center; margin-left:15px; padding-left:15px; border-left:1px solid rgba(255,255,255,0.3); font-weight:bold;">
<span class="mm-countdown-label">' . $countdown_label . ' </span>
<span class="mm-countdown-timer" data-date="' . $countdown_date . '" data-expired="' . $countdown_expired . '">Laden...</span>
</div>';
}
?>
<div id="mm-announcement"
data-position="<?php echo esc_attr($position); ?>"
style="
background: <?php echo esc_attr($bg); ?>;
color: <?php echo esc_attr($color); ?>;
font-size: <?php echo esc_attr($size); ?>px;
font-family: <?php echo esc_attr( $font_css_esc ); ?>;
">
<div class="mm-announcement-inner">
<div class="mm-announcement-text" style="display:inline-flex; align-items:center; width:100%; justify-content:center;">
<?php echo $text_kses; ?>
<?php echo $countdown_html; ?>
</div>
<button class="mm-announcement-close" aria-label="<?php esc_attr_e('Schließen','minecraft-modern-theme'); ?>">&times;</button>
</div>
</div>
<?php
}
add_action('wp_body_open', 'mm_render_announcement_bar');
/* ------------------ Assets: CSS & JS & Google Fonts ------------------ */
function mm_announcement_enqueue_assets() {
// Announcement CSS (theme/css/announcement.css)
wp_enqueue_style( 'mm-announcement-style', get_template_directory_uri() . '/css/announcement.css', array(), '1.2' );
// Announcement JS (frontend behavior)
wp_enqueue_script( 'mm-announcement-script', get_template_directory_uri() . '/js/announcement.js', array(), '1.3', true );
// Optional: Google Font load (only for selected font)
$fonts = mm_announcement_get_font_list();
$font_key = get_option('mm_announcement_font_family', 'inherit');
if ( isset( $fonts[ $font_key ] ) && ! empty( $fonts[ $font_key ]['google'] ) ) {
$google_name = $fonts[ $font_key ]['google_name'];
if ( $google_name ) {
$url = 'https://fonts.googleapis.com/css2?family=' . rawurlencode( $google_name ) . ':wght@400;700&display=swap';
wp_enqueue_style( 'mm-announcement-google-font', $url, array(), null );
}
}
}
add_action('wp_enqueue_scripts', 'mm_announcement_enqueue_assets');
/* -------------------------------------------------------------------------
* ANNOUNCEMENT ADMIN ASSETS
* ------------------------------------------------------------------------- */
function mm_announcement_admin_assets( $hook ) {
if ( $hook !== 'toplevel_page_mm-announcement' ) {
return;
}
// kleine Admin-CSS inline
wp_add_inline_style( 'wp-admin', '
.mm-announcement-admin .form-table th { width: 180px; vertical-align: top; }
.mm-announcement-admin .description { margin-top: 6px; color: #666; max-width: 720px; }
.mm-announcement-admin h2 { margin-top: 24px; }
#mm-announcement-preview { transition: all 140ms ease; }
#mm-announcement-preview-text { transition: font-family 160ms ease, font-size 120ms ease; white-space: normal; word-break: break-word; }
' );
// Admin JS (lade jQuery)
wp_enqueue_script( 'mm-announcement-admin-script', get_template_directory_uri() . '/js/mm-announcement-admin.js', array('jquery'), '1.1', true );
// Übergib Font-Metadaten an das Admin-Script
// Hinweis: Funktion mm_announcement_get_font_list() muss in deiner Datei definiert sein (aus vorherigem Code)
$fonts = mm_announcement_get_font_list();
wp_localize_script( 'mm-announcement-admin-script', 'MM_Announcement_Fonts', $fonts );
// Übergib aktuelle Werte für initiale Vorschau
$current = array(
'font' => get_option('mm_announcement_font_family', 'inherit'),
'size' => (int) get_option('mm_announcement_font_size', 16),
'bg' => get_option('mm_announcement_bg', '#1e1e1e'),
'color'=> get_option('mm_announcement_color', '#ffffff'),
'text' => wp_kses_post( get_option('mm_announcement_text') )
);
wp_localize_script( 'mm-announcement-admin-script', 'MM_Announcement_Current', $current );
}
add_action( 'admin_enqueue_scripts', 'mm_announcement_admin_assets' );
/* -------------------------------------------------------------------------
* COMPLETES TEAM MODUL (SICHER & FUNKTIONIEREND)
* ------------------------------------------------------------------------- */
// === 1. Custom Post Type Registrierung ===
function create_team_post_type() {
// Nur laden, wenn im Customizer aktiviert
if ( get_theme_mod( 'team_enabled', true ) ) {
register_post_type('team_member',
array(
'labels' => array(
'name' => __( 'Team', 'minecraft-modern-theme' ),
'singular_name' => __( 'Teammitglied', 'minecraft-modern-theme' ),
'add_new' => __( 'Neues Mitglied', 'minecraft-modern-theme' ),
'menu_name' => __( 'Team', 'minecraft-modern-theme' ),
),
'public' => true,
'has_archive' => true,
'menu_icon' => 'dashicons-groups',
'supports' => array( 'title', 'thumbnail', 'page-attributes' ),
'rewrite' => array( 'slug' => 'team' ),
'show_in_rest' => true,
// FIX: Standard-Menü ausblenden, wir nutzen nur den Manager
'show_in_menu' => false,
)
);
}
}
add_action('init', 'create_team_post_type');
// === 2. Meta-Box für Rang ===
function add_team_meta_boxes() {
add_meta_box(
'team_member_rank_box',
__( 'Rang & Position', 'minecraft-modern-theme' ),
'team_member_rank_callback',
'team_member',
'side',
'default'
);
}
add_action('add_meta_boxes', 'add_team_meta_boxes');
function team_member_rank_callback( $post ) {
wp_nonce_field( 'team_member_rank_save', 'team_member_rank_nonce' );
$value = get_post_meta( $post->ID, '_team_member_rank', true );
?>
<p>
<label for="team_member_rank" style="font-weight:600;">Rang:</label>
<input type="text" id="team_member_rank" name="team_member_rank" value="<?php echo esc_attr( $value ); ?>" style="width:100%;" placeholder="z.B. Admin, Mod">
</p>
<?php
}
function save_team_member_rank( $post_id ) {
if ( ! isset( $_POST['team_member_rank_nonce'] ) ) return;
if ( ! wp_verify_nonce( $_POST['team_member_rank_nonce'], 'team_member_rank_save' ) ) return;
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
if ( ! current_user_can( 'edit_post', $post_id ) ) return;
if ( isset( $_POST['team_member_rank'] ) ) {
update_post_meta( $post_id, '_team_member_rank', sanitize_text_field( $_POST['team_member_rank'] ) );
}
}
add_action( 'save_post', 'save_team_member_rank' );
// === 3. Team Manager Admin Page ===
add_action('admin_menu', 'register_team_manager_page');
function register_team_manager_page() {
add_menu_page(
'Team Manager',
'Team Manager',
'manage_options',
'mm-team-manager',
'mm_team_manager_page_html',
'dashicons-groups',
6
);
// FIX: Media Uploader Skript laden
add_action('admin_enqueue_scripts', function($hook) {
if ($hook === 'toplevel_page_mm-team-manager') {
wp_enqueue_media();
}
});
}
function mm_team_manager_page_html() {
?>
<div class="wrap" style="max-width: 1200px;">
<h1>Team Verwaltung</h1>
<p>Hier kannst du Teammitglieder hinzufügen, sortieren und bearbeiten.</p>
<!-- Formular -->
<div class="card" style="background: #fff; border: 1px solid #ccd0d4; border-left: 4px solid #0073aa; padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 1px rgba(0,0,0,.04);">
<h2>Neues Mitglied hinzufügen</h2>
<form id="mm-add-member-form" style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; align-items: start;">
<div>
<label for="new_name"><strong>Name:</strong></label><br>
<input type="text" id="new_name" style="width: 100%;" required>
</div>
<div>
<label for="new_rank"><strong>Rang:</strong></label><br>
<input type="text" id="new_rank" style="width: 100%;" placeholder="z.B. Admin, Mod">
</div>
<div style="grid-column: 1 / -1;">
<label for="new_bio"><strong>Kurzbeschreibung:</strong></label><br>
<textarea id="new_bio" rows="2" style="width: 100%;" placeholder="Kurztext..."></textarea>
</div>
<div style="grid-column: 1 / -1; display: flex; align-items: center; gap: 15px;">
<div style="flex: 1;">
<label><strong>Bild:</strong></label><br>
<input type="hidden" id="new_image_id" value="">
<button type="button" class="button mm-upload-btn" data-target="new_image_id">Bild auswählen</button>
<span id="new_image_name" style="margin-left: 10px; color: #666;">Kein Bild gewählt</span>
</div>
<div id="new_image_preview" style="width: 60px; height: 60px; background: #eee; border: 1px solid #ccc; display: flex; align-items: center; justify-content: center; overflow: hidden;"></div>
</div>
<div style="grid-column: 1 / -1;">
<button type="submit" class="button button-primary button-large" style="width: 100%;">Hinzufügen</button>
</div>
</form>
</div>
<!-- Tabelle -->
<div class="card" style="background: #fff; padding: 20px; box-shadow: 0 1px 1px rgba(0,0,0,.04);">
<table class="wp-list-table widefat fixed striped" id="team-table" style="width: 100%; table-layout: fixed;">
<thead>
<tr>
<th style="width: 80px;">Bild</th>
<th style="width: 25%;">Name</th>
<th style="width: 20%;">Rang</th>
<th>Bio</th>
<th style="width: 80px; text-align: center;">Sort.</th>
<th style="width: 140px; text-align: right;">Aktionen</th>
</tr>
</thead>
<tbody id="team-list-body">
<?php
$team_query = new WP_Query(array('post_type' => 'team_member', 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC'));
if ($team_query->have_posts()) :
while ($team_query->have_posts()) : $team_query->the_post();
$id = get_the_ID();
$name = get_the_title();
$rank = get_post_meta($id, '_team_member_rank', true);
$bio = get_the_content();
$img_id = get_post_thumbnail_id($id);
?>
<tr data-id="<?php echo $id; ?>">
<td style="text-align: center;">
<div class="thumb-preview" style="width: 40px; height: 40px; background: #eee; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 4px; border: 1px solid #ddd;">
<?php echo $img_id ? get_the_post_thumbnail($id, array(40,40)) : '<span style="font-size:20px;">👤</span>'; ?>
</div>
</td>
<td><input type="text" class="inline-edit" data-field="post_title" value="<?php echo esc_attr($name); ?>"></td>
<td><input type="text" class="inline-edit" data-field="_team_member_rank" value="<?php echo esc_attr($rank); ?>"></td>
<td><input type="text" class="inline-edit" data-field="post_content" value="<?php echo esc_attr(wp_strip_all_tags($bio)); ?>"></td>
<td style="text-align: center; vertical-align: middle;">
<button class="button button-small sort-up" title="Nach oben">▲</button>
<button class="button button-small sort-down" title="Nach unten">▼</button>
</td>
<td style="text-align: right; vertical-align: middle;">
<button class="button button-primary button-small save-row" title="Speichern">💾</button>
<button class="button button-small delete-row" title="Löschen">🗑️</button>
</td>
</tr>
<?php
endwhile;
else :
echo '<tr><td colspan="6" style="text-align:center;">Noch keine Mitglieder vorhanden.</td></tr>';
endif;
?>
</tbody>
</table>
</div>
</div>
<!-- CSS & JS -->
<style>
.inline-edit { width: 100%; box-sizing: border-box; padding: 6px; font-size: 13px; }
.card {width: 100%; max-width: 100%; padding: 25px; margin-top: 20px; border: 1px solid #c3c4c7; box-shadow: 0 1px 1px rgba(0, 0, 0, .04); background: #fff; box-sizing: border-box;}
#team-table td { overflow: hidden; }
.thumb-preview img { width: 100%; height: auto; object-fit: cover; }
.mm-upload-btn { margin-top: 5px; }
</style>
<script type="text/javascript">
jQuery(document).ready(function($) {
// --- 1. Media Uploader ---
var mediaUploader;
$(document).on('click', '.mm-upload-btn', function(e) {
e.preventDefault();
var targetInput = $(this).data('target');
var targetPreview = $(this).parent().find('div[id$="_preview"]');
var targetName = $(this).parent().find('span[id$="_name"]');
if (mediaUploader) { mediaUploader.open(); return; }
mediaUploader = wp.media.frames.file_frame = wp.media({
title: 'Bild auswählen', button: { text: 'Bild nutzen' }, multiple: false
});
mediaUploader.on('select', function() {
var attachment = mediaUploader.state().get('selection').first().toJSON();
$('#' + targetInput).val(attachment.id);
targetName.text(attachment.title);
targetPreview.html('<img src="' + attachment.sizes.thumbnail.url + '">');
});
mediaUploader.open();
});
// --- 2. Add Member ---
$('#mm-add-member-form').on('submit', function(e) {
e.preventDefault();
var btn = $(this).find('button[type="submit"]');
btn.prop('disabled', true).text('Lade...');
$.post(ajaxurl, {
action: 'mm_add_team_member',
name: $('#new_name').val(),
rank: $('#new_rank').val(),
bio: $('#new_bio').val(),
img_id: $('#new_image_id').val(),
nonce: '<?php echo wp_create_nonce('mm_team_nonce'); ?>'
}, function(response) {
if(response.success) { location.reload(); }
else { alert('Fehler: ' + response.data); btn.prop('disabled', false).text('Hinzufügen'); }
});
});
// --- 3. Save ---
$('.save-row').on('click', function() {
var row = $(this).closest('tr'); var btn = $(this);
var data = { action: 'mm_update_team_member', id: row.data('id'), nonce: '<?php echo wp_create_nonce('mm_team_nonce'); ?>' };
row.find('.inline-edit').each(function() {
var field = $(this).data('field'); var val = $(this).val();
if(field === 'post_title') data.title = val;
if(field === '_team_member_rank') data.rank = val;
if(field === 'post_content') data.bio = val;
});
btn.text('✓').prop('disabled', true);
$.post(ajaxurl, data, function(res) { setTimeout(function(){ btn.text('💾').prop('disabled', false); }, 1000); });
});
// --- 4. Delete ---
$('.delete-row').on('click', function() {
if(!confirm('Löschen?')) return; var row = $(this).closest('tr');
$.post(ajaxurl, { action: 'mm_delete_team_member', id: row.data('id'), nonce: '<?php echo wp_create_nonce('mm_team_nonce'); ?>' }, function() { row.fadeOut().remove(); });
});
// --- 5. Sort ---
$('.sort-up').on('click', function() { var row = $(this).closest('tr'); var prev = row.prev('tr'); if(prev.length > 0) row.insertBefore(prev); });
$('.sort-down').on('click', function() { var row = $(this).closest('tr'); var next = row.next('tr'); if(next.length > 0) row.insertAfter(next); });
});
</script>
<?php
}
// --- AJAX HANDLERS ---
add_action('wp_ajax_mm_add_team_member', 'handle_mm_add_member');
function handle_mm_add_member() {
check_ajax_referer('mm_team_nonce', 'nonce');
if (!current_user_can('publish_posts')) wp_send_json_error('Keine Berechtigung');
$id = wp_insert_post(array(
'post_title' => sanitize_text_field($_POST['name']),
'post_content' => sanitize_textarea_field($_POST['bio']),
'post_type' => 'team_member', 'post_status' => 'publish', 'menu_order' => 999
));
if ($id && !is_wp_error($id)) {
update_post_meta($id, '_team_member_rank', sanitize_text_field($_POST['rank']));
if (!empty($_POST['img_id'])) set_post_thumbnail($id, intval($_POST['img_id']));
wp_send_json_success('Hinzugefügt');
} else { wp_send_json_error('Fehler'); }
}
add_action('wp_ajax_mm_update_team_member', 'handle_mm_update_team_member');
function handle_mm_update_team_member() {
check_ajax_referer('mm_team_nonce', 'nonce');
if (!current_user_can('edit_posts')) wp_send_json_error('Keine Berechtigung');
$id = intval($_POST['id']);
wp_update_post(array('ID' => $id, 'post_title' => sanitize_text_field($_POST['title']), 'post_content' => sanitize_textarea_field($_POST['bio'])));
update_post_meta($id, '_team_member_rank', sanitize_text_field($_POST['rank']));
wp_send_json_success('Gespeichert');
}
add_action('wp_ajax_mm_delete_team_member', 'handle_mm_delete_team_member');
function handle_mm_delete_team_member() {
check_ajax_referer('mm_team_nonce', 'nonce');
if (!current_user_can('delete_posts')) wp_send_json_error('Keine Berechtigung');
wp_delete_post(intval($_POST['id']), true);
wp_send_json_success('Gelöscht');
}
// === 4. Automatische Team-Seite ===
function create_team_page_automatically() {
if ( get_theme_mod( 'team_enabled', true ) && get_page_by_title( 'Team' ) == null ) {
wp_insert_post( array( 'post_title' => 'Team', 'post_status' => 'publish', 'post_type' => 'page', 'post_author' => 1 ) );
}
}
add_action( 'customize_save_after', 'create_team_page_automatically' );
// === 5. Template Loader (ROBUSTER FIX) ===
function load_team_page_template( $template ) {
if ( ! get_theme_mod( 'team_enabled', true ) ) return $template;
// 1. Check auf Archiv-Seite
if ( is_post_type_archive('team_member') ) { return get_template_directory() . '/archive-team.php'; }
// 2. Check auf Seite anhand des Slugs
if ( is_page() ) {
// FIX: Korrekte Methode das Page-Objekt zu holen
$obj = get_queried_object();
if ( $obj && $obj->post_name === 'team' ) {
return get_template_directory() . '/archive-team.php';
}
}
return $template;
}
add_filter( 'template_include', 'load_team_page_template' );
// === 6. Customizer Settings ===
add_action( 'customize_register', 'team_customize_register' );
function team_customize_register( $wp_customize ) {
$wp_customize->add_section( 'team_settings', array( 'title' => 'Team Einstellungen', 'priority' => 65 ) );
$wp_customize->add_setting( 'team_enabled', array( 'default' => true, 'sanitize_callback' => 'wp_validate_boolean' ) );
$wp_customize->add_control( 'team_enabled', array( 'label' => 'Team Showcase aktivieren', 'section' => 'team_settings', 'settings' => 'team_enabled', 'type' => 'checkbox' ) );
}

View File

@@ -1,81 +1,79 @@
<!DOCTYPE html> <!DOCTYPE html>
<html <?php language_attributes(); ?>> <html <?php language_attributes(); ?>>
<head> <head>
<meta charset="<?php bloginfo( 'charset' ); ?>"> <meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1"> <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"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<?php wp_head(); ?> <?php wp_head(); ?>
</head> </head>
<body <?php body_class(); ?>> <body <?php body_class(); ?>>
<header id="masthead" class="site-header"> <?php wp_body_open(); ?>
<div class="container">
<div class="header-main"> <header id="masthead" class="site-header">
<div class="site-branding"> <div class="container">
<?php <div class="header-main">
if ( function_exists( 'the_custom_logo' ) && has_custom_logo() ) { <div class="site-branding">
the_custom_logo(); <?php
} if ( function_exists( 'the_custom_logo' ) && has_custom_logo() ) {
?> the_custom_logo();
}
<?php ?>
if ( is_front_page() && is_home() ) :
?> <?php
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1> if ( is_front_page() && is_home() ) :
<?php else : ?> ?>
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p> <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<?php endif; ?> <?php else : ?>
</div> <p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
<?php endif; ?>
<!-- NAVIGATION START --> </div>
<nav id="site-navigation" class="main-navigation">
<!-- Mobile Toggle Button --> <!-- NAVIGATION START -->
<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false"> <nav id="site-navigation" class="main-navigation" role="navigation" aria-label="<?php esc_attr_e('Hauptmenü','minecraft-modern-theme'); ?>">
<i class="fas fa-bars"></i> <!-- Mobile Toggle Button -->
</button> <button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false">
<i class="fas fa-bars"></i>
<?php </button>
wp_nav_menu( array(
'theme_location' => 'primary', <?php
'container' => false, // Wichtig: Kein Div-Wrapper drumherum wp_nav_menu( array(
'menu_class' => 'primary-menu', // Unsere CSS Klasse 'theme_location' => 'primary',
'fallback_cb' => false, // Kein Fallback anzeigen 'container' => false,
) ); 'menu_class' => 'primary-menu',
?> 'fallback_cb' => false,
</nav> ) );
<!-- NAVIGATION ENDE --> ?>
</nav>
<div class="header-info"> <!-- NAVIGATION ENDE -->
<div class="social-links">
<?php <div class="header-info">
// Array mit den Social-Media-Plattformen und ihren Font Awesome Klassen <div class="social-links">
$social_icons = array( <?php
'discord' => 'fab fa-discord', $social_icons = array(
'youtube' => 'fab fa-youtube', 'discord' => 'fab fa-discord',
'twitter' => 'fab fa-x-twitter', // Neues Icon für Twitter/X 'youtube' => 'fab fa-youtube',
'facebook' => 'fab fa-facebook-f', 'twitter' => 'fab fa-x-twitter',
'instagram' => 'fab fa-instagram', 'facebook' => 'fab fa-facebook-f',
'tiktok' => 'fab fa-tiktok', 'instagram' => 'fab fa-instagram',
'twitch' => 'fab fa-twitch', 'tiktok' => 'fab fa-tiktok',
'steam' => 'fab fa-steam', 'twitch' => 'fab fa-twitch',
'github' => 'fab fa-github', 'steam' => 'fab fa-steam',
'linkedin' => 'fab fa-linkedin-in', 'github' => 'fab fa-github',
'pinterest' => 'fab fa-pinterest-p', 'linkedin' => 'fab fa-linkedin-in',
'reddit' => 'fab fa-reddit-alien', 'pinterest' => 'fab fa-pinterest-p',
'teamspeak' => 'fab fa-teamspeak', 'reddit' => 'fab fa-reddit-alien',
'spotify' => 'fab fa-spotify' 'teamspeak' => 'fab fa-teamspeak',
); 'spotify' => 'fab fa-spotify'
);
// Schleife, die alle verfügbaren Icons durchgeht
foreach ($social_icons as $key => $class) { 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 ) ) {
if (get_theme_mod('social_' . $key)) { echo '<a href="' . esc_url( get_theme_mod( 'social_' . $key ) ) . '" target="_blank" rel="noopener"><i class="' . esc_attr( $class ) . '"></i></a>';
// 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-main -->
</div> </div>
</div> </header>
</div>
</header>

View File

@@ -1,4 +1,16 @@
<?php <?php
/**
* Minecraft Modern Theme - Customizer Settings
*
* Enthält Einstellungen für:
* - Header Slider & Hero
* - Theme Presets (Nether, End, Classic)
* - Farben & Darstellung
* - Social Media
* - Footer
* - Login
* - Import/Export
*/
function minecraft_modern_customize_register( $wp_customize ) { function minecraft_modern_customize_register( $wp_customize ) {
@@ -68,7 +80,7 @@ function minecraft_modern_customize_register( $wp_customize ) {
'label' => 'Schriftfarbe', 'section' => 'header_slider', 'settings' => 'slider_font_color', 'label' => 'Schriftfarbe', 'section' => 'header_slider', 'settings' => 'slider_font_color',
) ) ); ) ) );
// === VERGESSENE EINSTELLUNG WIEDER HINZUGEFÜGT === // Header-Höhe
$wp_customize->add_setting( 'header_height', array( 'default' => 'mittel', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_setting( 'header_height', array( 'default' => 'mittel', 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control( 'header_height', array( $wp_customize->add_control( 'header_height', array(
'label' => 'Header-Höhe', 'section' => 'header_slider', 'settings' => 'header_height', 'type' => 'select', 'label' => 'Header-Höhe', 'section' => 'header_slider', 'settings' => 'header_height', 'type' => 'select',
@@ -84,10 +96,6 @@ function minecraft_modern_customize_register( $wp_customize ) {
'label' => 'Paginierung (Punkte) ausblenden', 'section' => 'header_slider', 'settings' => 'slider_hide_pagination', 'type' => 'checkbox', 'label' => 'Paginierung (Punkte) ausblenden', 'section' => 'header_slider', 'settings' => 'slider_hide_pagination', 'type' => 'checkbox',
) ); ) );
// =========================================================================
// === ENTFERNT: Slider-Effekt-Einstellungen ==============================
// =========================================================================
// --- Sektion: Startseiten-Hero (Fallback) --- // --- Sektion: Startseiten-Hero (Fallback) ---
$wp_customize->add_section( 'hero_section', array( $wp_customize->add_section( 'hero_section', array(
'title' => 'Startseiten-Hero (wenn Slider deaktiviert)', 'title' => 'Startseiten-Hero (wenn Slider deaktiviert)',
@@ -113,7 +121,7 @@ function minecraft_modern_customize_register( $wp_customize ) {
// --- Checkbox: Seitentitel auf Startseite verstecken --- // --- Checkbox: Seitentitel auf Startseite verstecken ---
$wp_customize->add_setting( 'show_home_title', array( $wp_customize->add_setting( 'show_home_title', array(
'default' => false, // Standard: Aus (Titel wird versteckt) 'default' => false,
'sanitize_callback' => 'wp_validate_boolean', 'sanitize_callback' => 'wp_validate_boolean',
) ); ) );
$wp_customize->add_control( 'show_home_title', array( $wp_customize->add_control( 'show_home_title', array(
@@ -135,6 +143,34 @@ function minecraft_modern_customize_register( $wp_customize ) {
'priority' => 30, 'priority' => 30,
) ); ) );
// =========================================================================
// === NEU: THEME PRESETS (VOREINSTELLUNGEN) ==============================
// =========================================================================
$wp_customize->add_setting( 'theme_color_preset', array(
'default' => 'classic',
'sanitize_callback' => 'sanitize_key',
'transport' => 'refresh',
) );
$wp_customize->add_control( 'theme_color_preset', array(
'label' => 'Theme Preset (Farbschema)',
'description' => 'Wähle ein voreingestelltes Farbschema (z. B. für Nether oder End Dimension).',
'section' => 'theme_appearance_settings',
'settings' => 'theme_color_preset',
'type' => 'select',
'priority' => 1, // Zeig es ganz oben in dieser Sektion an
'choices' => array(
'classic' => 'Classic Minecraft (Diamant-Blau)',
'nether' => 'Nether (Lava-Rot)',
'end' => 'The End (Ender-Purpur)',
),
) );
// =========================================================================
// === ENDE THEME PRESETS ==================================================
// =========================================================================
// Akzentfarbe // Akzentfarbe
$wp_customize->add_setting( 'primary_accent_color', array( 'default' => '#00d4ff', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'refresh' ) ); $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( $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'primary_accent_color', array(
@@ -215,6 +251,13 @@ function minecraft_modern_customize_register( $wp_customize ) {
'label' => 'FAQ System aktivieren', 'section' => 'faq_settings', 'settings' => 'faq_enabled', 'type' => 'checkbox', 'label' => 'FAQ System aktivieren', 'section' => 'faq_settings', 'settings' => 'faq_enabled', 'type' => 'checkbox',
) ); ) );
// --- Sektion: Team Einstellungen ---
$wp_customize->add_section( 'team_settings', array( 'title' => 'Team Einstellungen', 'priority' => 65 ) );
$wp_customize->add_setting( 'team_enabled', array( 'default' => true, 'sanitize_callback' => 'wp_validate_boolean' ) );
$wp_customize->add_control( 'team_enabled', array(
'label' => 'Team Showcase aktivieren', 'section' => 'team_settings', 'settings' => 'team_enabled', 'type' => 'checkbox',
) );
// ========================================================================= // =========================================================================
// === 6. LOGIN-BEREICH ==================================================== // === 6. LOGIN-BEREICH ====================================================
// ========================================================================= // =========================================================================
@@ -276,6 +319,121 @@ function minecraft_modern_customize_register( $wp_customize ) {
'type' => 'number', 'type' => 'number',
'input_attrs' => array( 'min' => 2, 'max' => 10, 'step' => 1 ), 'input_attrs' => array( 'min' => 2, 'max' => 10, 'step' => 1 ),
) ); ) );
// =========================================================================
// === 7. EXPORT / IMPORT SECTION =========================================
// =========================================================================
$wp_customize->add_section( 'theme_mods_import_export', array(
'title' => __( 'Einstellungen sichern', 'minecraft-modern-theme' ),
'priority' => 999,
'description' => '',
) );
// Füge ein Custom Control mit HTML hinzu
$wp_customize->add_setting( 'import_export_placeholder', array(
'sanitize_callback' => 'sanitize_text_field',
) );
// Custom Control Class für Export/Import
class Import_Export_Control extends WP_Customize_Control {
public $type = 'import_export';
public function render_content() {
$export_url = admin_url('admin-post.php?action=export_theme_settings');
$nonce = wp_create_nonce('theme-import-nonce');
?>
<div class="import-export-wrapper" style="margin-top: 15px;">
<p class="description" style="margin-bottom: 20px;">
<strong>Hinweis:</strong> Hier kannst du alle deine Theme-Einstellungen sichern und wiederherstellen.
</p>
<a href="<?php echo esc_url($export_url); ?>" class="button button-primary button-hero" id="export-settings-btn" style="display: inline-flex; align-items: center; gap: 8px; margin-bottom: 20px;">
<span class="dashicons dashicons-download" style="margin-top:3px;"></span> Einstellungen Exportieren
</a>
<div style="border-top: 2px solid #ddd; padding-top: 20px; margin-top: 20px;">
<label style="display:block; margin-bottom:10px; font-weight:bold;">
Backup wiederherstellen:
</label>
<input type="file" id="import-settings-file" accept=".json" style="width:100%; margin-bottom:10px;">
<button type="button" class="button button-secondary" id="import-settings-btn" disabled style="display: inline-flex; align-items: center; gap: 8px;">
<span class="dashicons dashicons-upload" style="margin-top:3px;"></span> Einstellungen Importieren
</button>
</div>
<p class="description" style="margin-top:15px; padding: 10px; background: #fff3cd; border-left: 4px solid #ffc107;">
<strong>⚠️ Warnung:</strong> Beim Import werden alle aktuellen Einstellungen überschrieben!
</p>
</div>
<script type="text/javascript">
(function($) {
var ajaxUrl = '<?php echo admin_url('admin-ajax.php'); ?>';
var nonce = '<?php echo $nonce; ?>';
$('#import-settings-file').on('change', function() {
$('#import-settings-btn').prop('disabled', $(this).val() === '');
});
$('#import-settings-btn').on('click', function() {
var fileInput = $('#import-settings-file')[0];
if (fileInput.files.length === 0) {
alert('Bitte wähle eine JSON-Datei aus.');
return;
}
if (!confirm('WARNUNG: Alle aktuellen Einstellungen werden überschrieben. Bist du sicher?')) {
return;
}
var formData = new FormData();
formData.append('import_file', fileInput.files[0]);
formData.append('action', 'import_theme_settings');
formData.append('nonce', nonce);
var $btn = $(this);
var originalText = $btn.html();
$btn.prop('disabled', true).html('<span class="dashicons dashicons-update" style="margin-top:3px; animation: rotation 1s infinite linear;"></span> Importiere...');
$.ajax({
url: ajaxUrl,
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
if (response.success) {
alert('✅ ' + response.data);
location.reload();
} else {
alert('❌ Fehler: ' + response.data);
$btn.prop('disabled', false).html(originalText);
}
},
error: function() {
alert('❌ Ein technischer Fehler ist aufgetreten.');
$btn.prop('disabled', false).html(originalText);
}
});
});
})(jQuery);
</script>
<style>
@keyframes rotation {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
</style>
<?php
}
}
$wp_customize->add_control( new Import_Export_Control( $wp_customize, 'import_export_placeholder', array(
'section' => 'theme_mods_import_export',
) ) );
} }
add_action( 'customize_register', 'minecraft_modern_customize_register' ); add_action( 'customize_register', 'minecraft_modern_customize_register' );
@@ -289,7 +447,7 @@ function minecraft_modern_dynamic_css_output() {
$slider_font = get_theme_mod( 'slider_font_family', 'Raleway' ); $slider_font = get_theme_mod( 'slider_font_family', 'Raleway' );
$slider_color = get_theme_mod( 'slider_font_color', '#ffffff' ); $slider_color = get_theme_mod( 'slider_font_color', '#ffffff' );
$slider_size_setting = get_theme_mod( 'slider_font_size', 'mittel' ); $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_height_setting = get_theme_mod( 'header_height', 'mittel' );
// Header-Höhe umwandeln // Header-Höhe umwandeln
$header_height_value = '300px'; $header_height_value = '300px';
@@ -329,10 +487,6 @@ function minecraft_modern_dynamic_css_output() {
font-size: <?php echo esc_attr($chosen_sizes['subtitle']); ?>; font-size: <?php echo esc_attr($chosen_sizes['subtitle']); ?>;
} }
/* =================================================================== */
/* === NEU: Trennlinien mit der Akzentfarbe ========================= */
/* =================================================================== */
/* Trennlinie unter dem Header */ /* Trennlinie unter dem Header */
.site-header { .site-header {
border-bottom: 4px solid var(--primary-accent); border-bottom: 4px solid var(--primary-accent);
@@ -347,8 +501,48 @@ function minecraft_modern_dynamic_css_output() {
.site-footer { .site-footer {
border-top: 4px solid var(--primary-accent); border-top: 4px solid var(--primary-accent);
} }
</style> </style>
<?php <?php
} }
add_action( 'wp_head', 'minecraft_modern_dynamic_css_output' ); add_action( 'wp_head', 'minecraft_modern_dynamic_css_output' );
// =========================================================================
// === THEME PRESET LOGIC (JAVASCRIPT) =====================================
// =========================================================================
/**
* Verbindet das Preset-Dropdown mit der Akzentfarbe-Einstellung.
* Sobald ein Preset gewählt wird, wird die Farbe im Customizer aktualisiert.
*/
function minecraft_preset_customize_js() {
?>
<script type="text/javascript">
(function($) {
// Definiere die Farben für die Presets
var presetColors = {
'classic': '#00d4ff', // Diamant Blau
'nether': '#ff3333', // Lava Rot
'end': '#aa00ff' // Ender Purpur
};
// Warten bis der Customizer bereit ist
wp.customize.bind('ready', function() {
// Listener für das Preset-Dropdown
wp.customize('theme_color_preset', function(setting) {
setting.bind(function(to) {
// Wenn eine Farbe für das gewählte Preset existiert...
if (presetColors[to]) {
// ...setze die Akzentfarbe auf diesen Wert.
// Das aktualisiert auch den Color Picker und die Live-Vorschau.
wp.customize('primary_accent_color').set(presetColors[to]);
}
});
});
});
})(jQuery);
</script>
<?php
}
add_action('customize_controls_print_footer_scripts', 'minecraft_preset_customize_js');

View File

@@ -1,125 +1,142 @@
<?php <?php
// Exit if accessed directly. // Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; exit;
} }
// === ZENTRALE VERSIONSKONSTANTE === // === ZENTRALE VERSIONSKONSTANTE ===
// Bitte passen Sie diese Version bei jedem Release an! define( 'MINECRAFT_MODERN_THEME_VERSION', '1.6' );
define( 'MINECRAFT_MODERN_THEME_VERSION', '1.4' );
// === THEME UPDATE NOTIFICATION SYSTEM ===
// === THEME UPDATE NOTIFICATION SYSTEM === // Funktion zum Leeren des Caches (wenn man auf "Update prüfen" klickt)
function minecraft_modern_clear_cache() {
// Funktion zum Abrufen der neuesten Release-Informationen vom Git-Repository if ( isset( $_GET['mm_clear_cache'] ) && current_user_can( 'manage_options' ) ) {
function minecraft_modern_get_latest_release_info() { check_admin_referer( 'mm_clear_cache_action' );
$transient_key = 'minecraft_modern_latest_release'; delete_transient( 'minecraft_modern_latest_release' );
wp_redirect( admin_url( 'index.php' ) );
// Versuche, die Daten aus dem Transient-Cache zu holen exit;
$release_info = get_transient($transient_key); }
}
// Wenn der Cache leer oder abgelaufen ist, rufe neue Daten ab add_action( 'admin_init', 'minecraft_modern_clear_cache' );
if (false === $release_info) {
$response = wp_remote_get('https://git.viper.ipv64.net/api/v1/repos/M_Viper/Minecraft-Modern-Theme/releases/latest'); // Funktion zum Abrufen der neuesten Release-Informationen
function minecraft_modern_get_latest_release_info( $force_refresh = false ) {
if (!is_wp_error($response) && 200 === wp_remote_retrieve_response_code($response)) { $transient_key = 'minecraft_modern_latest_release';
$body = wp_remote_retrieve_body($response);
$release_data = json_decode($body, true); // Wenn erzwungen wird (oder Cache leer), frische Daten holen
if ( $force_refresh ) {
if ($release_data && isset($release_data['tag_name'])) { delete_transient( $transient_key );
$release_info = array( }
'version' => $release_data['tag_name'],
'download_url' => $release_data['zipball_url'], $release_info = get_transient( $transient_key );
'release_notes' => isset($release_data['body']) ? $release_data['body'] : '',
'published_at' => isset($release_data['published_at']) ? $release_data['published_at'] : '' if ( false === $release_info ) {
); // Timeout auf 10 Sekunden erhöht für langsame Verbindungen
$response = wp_remote_get( 'https://git.viper.ipv64.net/api/v1/repos/M_Viper/Minecraft-Modern-Theme/releases/latest', array( 'timeout' => 10 ) );
// Speichere die Daten für 12 Stunden im Cache
set_transient($transient_key, $release_info, 12 * HOUR_IN_SECONDS); if ( ! is_wp_error( $response ) && 200 === wp_remote_retrieve_response_code( $response ) ) {
} $body = wp_remote_retrieve_body( $response );
} else { $release_data = json_decode( $body, true );
// Bei Fehler, leere Daten für 1 Stunde cachen, um wiederholte fehlgeschlagene Anfragen zu vermeiden
set_transient($transient_key, array(), HOUR_IN_SECONDS); if ( $release_data && isset( $release_data['tag_name'] ) ) {
} // Tag bereinigen (falls 'v' davor steht, z.B. v1.6 -> 1.6)
} $tag_name = $release_data['tag_name'];
if ( strpos( $tag_name, 'v' ) === 0 ) {
return $release_info; $tag_name = ltrim( $tag_name, 'v' );
} }
// Funktion zum Anzeigen der Update-Benachrichtigung im Admin-Bereich $release_info = array(
function minecraft_modern_show_update_notification() { 'version' => $tag_name,
// Nur im Admin-Bereich und für Administratoren anzeigen 'download_url' => $release_data['zipball_url'],
if (!is_admin() || !current_user_can('manage_options')) { 'release_notes' => isset( $release_data['body'] ) ? $release_data['body'] : '',
return; 'published_at' => isset( $release_data['published_at'] ) ? $release_data['published_at'] : ''
} );
// Aktuelle Theme-Version abrufen (JETZT AUS UNSERER KONSTANTE) // Cache für 6 Stunden (kannst du anpassen)
$current_version = MINECRAFT_MODERN_THEME_VERSION; set_transient( $transient_key, $release_info, 6 * HOUR_IN_SECONDS );
} else {
// Neueste Release-Informationen abrufen // Fehlerhafte Daten leer cachen
$latest_release = minecraft_modern_get_latest_release_info(); set_transient( $transient_key, array(), HOUR_IN_SECONDS );
}
// Wenn wir gültige Release-Informationen haben und die Versionen unterschiedlich sind } else {
if (!empty($latest_release) && isset($latest_release['version']) && version_compare($current_version, $latest_release['version'], '<')) { // Fehler beim Abrufen
?> set_transient( $transient_key, array(), HOUR_IN_SECONDS );
<div class="notice notice-warning is-dismissible"> }
<h3><?php _e('Minecraft Modern Theme Update Available', 'minecraft-modern-theme'); ?></h3> }
<p>
<?php return $release_info;
printf( }
__('You are using version %1$s of the Minecraft Modern Theme. Version %2$s is now available.', 'minecraft-modern-theme'),
'<strong>' . esc_html($current_version) . '</strong>', // Benachrichtigung im Admin-Bereich
'<strong>' . esc_html($latest_release['version']) . '</strong>' function minecraft_modern_show_update_notification() {
); if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
?> return;
</p> }
<p>
<a href="<?php echo esc_url($latest_release['download_url']); ?>" class="button button-primary" target="_blank"> $current_version = MINECRAFT_MODERN_THEME_VERSION;
<?php _e('Download Latest Version', 'minecraft-modern-theme'); ?> $latest_release = minecraft_modern_get_latest_release_info();
</a>
<a href="https://git.viper.ipv64.net/M_Viper/Minecraft-Modern-Theme/releases" class="button" target="_blank"> if ( ! empty( $latest_release ) && isset( $latest_release['version'] ) && version_compare( $current_version, $latest_release['version'], '<' ) ) {
<?php _e('View Release Notes', 'minecraft-modern-theme'); ?> ?>
</a> <div class="notice notice-warning is-dismissible">
</p> <h3><?php _e( 'Minecraft Modern Theme Update Available', 'minecraft-modern-theme' ); ?></h3>
</div> <p>
<?php <?php
} printf(
} __( 'You are using version %1$s of the Minecraft Modern Theme. Version %2$s is now available.', 'minecraft-modern-theme' ),
add_action('admin_notices', 'minecraft_modern_show_update_notification'); '<strong>' . esc_html( $current_version ) . '</strong>',
'<strong>' . esc_html( $latest_release['version'] ) . '</strong>'
// Funktion zum Hinzufügen eines Update-Status-Widgets zum Dashboard );
function minecraft_modern_add_dashboard_widget() { ?>
wp_add_dashboard_widget( </p>
'minecraft_modern_update_widget', // Widget slug. <p>
'Minecraft Modern Theme Status', // Title. <a href="<?php echo esc_url( $latest_release['download_url'] ); ?>" class="button button-primary" target="_blank">
'minecraft_modern_update_widget_function' // Display function. <?php _e( 'Download Latest Version', 'minecraft-modern-theme' ); ?>
); </a>
} <a href="https://git.viper.ipv64.net/M_Viper/Minecraft-Modern-Theme/releases" class="button" target="_blank">
add_action('wp_dashboard_setup', 'minecraft_modern_add_dashboard_widget'); <?php _e( 'View Release Notes', 'minecraft-modern-theme' ); ?>
</a>
// Funktion zum Anzeigen des Inhalts im Dashboard-Widget </p>
function minecraft_modern_update_widget_function() { </div>
// Aktuelle Theme-Version abrufen (JETZT AUS UNSERER KONSTANTE) <?php
$current_version = MINECRAFT_MODERN_THEME_VERSION; }
}
// Neueste Release-Informationen abrufen add_action( 'admin_notices', 'minecraft_modern_show_update_notification' );
$latest_release = minecraft_modern_get_latest_release_info();
// Dashboard Widget
echo '<p><strong>' . __('Current Version:', 'minecraft-modern-theme') . '</strong> ' . esc_html($current_version) . '</p>'; function minecraft_modern_add_dashboard_widget() {
wp_add_dashboard_widget(
if (!empty($latest_release) && isset($latest_release['version'])) { 'minecraft_modern_update_widget',
if (version_compare($current_version, $latest_release['version'], '<')) { 'Minecraft Modern Theme Status',
echo '<p><strong>' . __('Latest Version:', 'minecraft-modern-theme') . '</strong> <span style="color: #d63638;">' . esc_html($latest_release['version']) . '</span></p>'; 'minecraft_modern_update_widget_function'
echo '<p><strong>' . __('Status:', 'minecraft-modern-theme') . '</strong> <span style="color: #d63638;">' . __('Update Available', 'minecraft-modern-theme') . '</span></p>'; );
echo '<p><a href="' . esc_url($latest_release['download_url']) . '" class="button button-primary" target="_blank">' . __('Download Update', 'minecraft-modern-theme') . '</a></p>'; }
} else { add_action( 'wp_dashboard_setup', 'minecraft_modern_add_dashboard_widget' );
echo '<p><strong>' . __('Latest Version:', 'minecraft-modern-theme') . '</strong> <span style="color: #46b450;">' . esc_html($latest_release['version']) . '</span></p>';
echo '<p><strong>' . __('Status:', 'minecraft-modern-theme') . '</strong> <span style="color: #46b450;">' . __('Up to Date', 'minecraft-modern-theme') . '</span></p>'; function minecraft_modern_update_widget_function() {
} $current_version = MINECRAFT_MODERN_THEME_VERSION;
} else { $latest_release = minecraft_modern_get_latest_release_info();
echo '<p><strong>' . __('Status:', 'minecraft-modern-theme') . '</strong> ' . __('Unable to check for updates', 'minecraft-modern-theme') . '</p>';
} echo '<p><strong>' . __( 'Current Version:', 'minecraft-modern-theme' ) . '</strong> ' . esc_html( $current_version ) . '</p>';
echo '<p><a href="https://git.viper.ipv64.net/M_Viper/Minecraft-Modern-Theme/releases" target="_blank">' . __('View All Releases', 'minecraft-modern-theme') . '</a></p>'; if ( ! empty( $latest_release ) && isset( $latest_release['version'] ) ) {
echo '<p><strong>' . __( 'Latest Version:', 'minecraft-modern-theme' ) . '</strong> ' . esc_html( $latest_release['version'] ) . '</p>';
if ( version_compare( $current_version, $latest_release['version'], '<' ) ) {
echo '<p><strong>' . __( 'Status:', 'minecraft-modern-theme' ) . '</strong> <span style="color: #d63638;">' . __( 'Update Available', 'minecraft-modern-theme' ) . '</span></p>';
echo '<p><a href="' . esc_url( $latest_release['download_url'] ) . '" class="button button-primary" target="_blank">' . __( 'Download Update', 'minecraft-modern-theme' ) . '</a></p>';
} else {
echo '<p><strong>' . __( 'Status:', 'minecraft-modern-theme' ) . '</strong> <span style="color: #46b450;">' . __( 'Up to Date', 'minecraft-modern-theme' ) . '</span></p>';
}
} else {
echo '<p><strong>' . __( 'Status:', 'minecraft-modern-theme' ) . '</strong> ' . __( 'Unable to check for updates', 'minecraft-modern-theme' ) . '</p>';
}
// Link für "Jetzt prüfen" hinzugefügt
$refresh_url = wp_nonce_url( admin_url( 'index.php?mm_clear_cache=1' ), 'mm_clear_cache_action' );
echo '<p><a href="' . esc_url( $refresh_url ) . '" onclick="return confirm(\'Cache leeren und neu prüfen?\');">' . __( 'Check for Updates Now', 'minecraft-modern-theme' ) . '</a></p>';
echo '<p><a href="https://git.viper.ipv64.net/M_Viper/Minecraft-Modern-Theme/releases" target="_blank">' . __( 'View All Releases', 'minecraft-modern-theme' ) . '</a></p>';
} }

View File

@@ -0,0 +1,84 @@
document.addEventListener("DOMContentLoaded", function () {
const bar = document.getElementById("mm-announcement");
if (!bar) return;
// --- 1. Positionierung ---
const position = bar.dataset.position || 'below-header';
if (position === "top") {
document.body.insertAdjacentElement('afterbegin', bar);
}
else if (position === "below-slider") {
const anchor = document.getElementById("mm-announcement-anchor");
if (anchor) {
anchor.replaceWith(bar);
} else {
const header = document.getElementById("masthead");
if (header) header.insertAdjacentElement('afterend', bar);
}
}
else if (position === "below-header") {
const header = document.getElementById("masthead");
if (header) header.insertAdjacentElement('afterend', bar);
}
else {
const header = document.getElementById("masthead");
if (header) header.insertAdjacentElement('afterend', bar);
}
const closeBtn = bar.querySelector(".mm-announcement-close");
if (closeBtn) {
closeBtn.addEventListener("click", function () {
bar.style.display = "none";
});
}
// --- 2. Countdown Timer Logik ---
const timerElement = document.querySelector('.mm-countdown-timer');
if (timerElement) {
const targetDateString = timerElement.getAttribute('data-date');
const expiredMessage = timerElement.getAttribute('data-expired');
// Prüfen ob Datum gesetzt ist
if (targetDateString) {
const countDownDate = new Date(targetDateString).getTime();
const updateTimer = setInterval(function() {
const now = new Date().getTime();
const distance = countDownDate - now;
if (distance < 0) {
clearInterval(updateTimer);
timerElement.innerHTML = expiredMessage;
// Optional: Rot einfärben wenn abgelaufen
timerElement.style.color = '#ff3333';
return;
}
// Zeitberechnung
const days = Math.floor(distance / (1000 * 60 * 60 * 24));
const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Formatierung (z.B. 05 statt 5)
const fDays = days > 0 ? days + "d " : "";
const fHours = hours < 10 ? "0" + hours : hours;
const fMinutes = minutes < 10 ? "0" + minutes : minutes;
const fSeconds = seconds < 10 ? "0" + seconds : seconds;
timerElement.innerHTML = fDays + fHours + ":" + fMinutes + ":" + fSeconds;
}, 1000);
// Sofort einmal ausführen, um Ladezeit zu vermeiden
// Wir lösen das Interval manuell für den ersten Durchlauf aus,
// indem wir den Code kopieren oder den Timeout kurz setzen.
// Für diesen Fall reicht der erste Tick nach 1 Sekunde,
// aber wir können es direkt aufrufen:
// (Hier nutzen wir einfach den ersten Tick des Intervals)
} else {
timerElement.style.display = 'none';
}
}
});

View File

@@ -0,0 +1,158 @@
(function($){
$(document).ready(function(){
const fonts = window.MM_Announcement_Fonts || {};
const current = window.MM_Announcement_Current || {};
const fontSelect = $('#mm-announcement-font');
const sizeInput = $('#mm-announcement-size');
const bgInput = $('#mm-announcement-bg');
const colorInput = $('#mm-announcement-color');
const previewText = $('#mm-announcement-preview-text');
const previewWrap = $('#mm-announcement-preview');
const positionSelect = $('#mm-announcement-position');
// Helper: lädt Google-Font-Link oder updatet existing
function ensureGoogleFont(googleName) {
if (!googleName) return;
const id = 'mm-admin-google-font';
const href = 'https://fonts.googleapis.com/css2?family=' + encodeURIComponent(googleName) + ':wght@400;700&display=swap';
let link = document.getElementById(id);
if (link) {
if (link.getAttribute('href') !== href) link.setAttribute('href', href);
} else {
link = document.createElement('link');
link.id = id;
link.rel = 'stylesheet';
link.href = href;
document.head.appendChild(link);
}
}
// Update preview appearance based on font key
function updatePreviewForFontKey(key) {
const meta = fonts[key];
if (!meta) {
previewText.css('font-family', '');
return;
}
previewText.css('font-family', meta.css);
if (meta.google && meta.google_name) {
ensureGoogleFont(meta.google_name);
}
}
// Update size/colors/position UI
function updateSizeAndColors() {
const size = parseInt(sizeInput.val(), 10) || 16;
previewText.css('font-size', size + 'px');
previewWrap.css('background', bgInput.val());
previewWrap.css('color', colorInput.val());
}
// Read content from wp_editor (TinyMCE) or textarea
function getEditorText() {
// Try TinyMCE first
if ( typeof tinymce !== 'undefined' ) {
try {
const ed = tinymce.get('mm_announcement_text');
if (ed && !ed.isHidden()) {
// getContent then strip tags
const html = ed.getContent({format: 'html'});
const tmp = document.createElement('div');
tmp.innerHTML = html;
return tmp.textContent || tmp.innerText || '';
}
} catch (e) {
// ignore
}
}
// Fallback to textarea
const ta = $('#mm_announcement_text');
if (ta.length) {
const tmp = document.createElement('div');
tmp.innerHTML = ta.val();
return tmp.textContent || tmp.innerText || '';
}
return '';
}
// Update preview text from editor content
function updatePreviewTextFromEditor() {
const text = getEditorText();
if (text && text.trim().length) {
previewText.text(text.trim());
} else {
previewText.text(current.text || 'Das ist eine Vorschau: Wie sieht die Schrift aus?');
}
}
// Initialize controls with current settings
if (current.font) {
updatePreviewForFontKey(current.font);
fontSelect.val(current.font);
} else {
updatePreviewForFontKey(fontSelect.val());
}
if (current.size) sizeInput.val(current.size);
if (current.bg) bgInput.val(current.bg);
if (current.color) colorInput.val(current.color);
updateSizeAndColors();
updatePreviewTextFromEditor();
// Attach events --------------------------------------------------
// font change
fontSelect.on('change', function(){
const key = $(this).val();
updatePreviewForFontKey(key);
});
// size/color/position change
sizeInput.on('input change', updateSizeAndColors );
bgInput.on('input change', updateSizeAndColors );
colorInput.on('input change', updateSizeAndColors );
// Editor changes:
// - TinyMCE: listen for keyup / change events when editor is ready
// - Textarea: listen for input
function attachEditorListeners() {
// TinyMCE
if ( typeof tinymce !== 'undefined' ) {
const ed = tinymce.get('mm_announcement_text');
if (ed) {
ed.on('keyup change NodeChange', function(){
updatePreviewTextFromEditor();
});
}
}
// Textarea fallback
$('#mm_announcement_text').on('input change', function(){
updatePreviewTextFromEditor();
});
}
// TinyMCE initialisation might be async — poll short time then attach
let tries = 0;
const waitForEditor = setInterval(function(){
tries++;
if ( (typeof tinymce !== 'undefined' && tinymce.get('mm_announcement_text')) || $('#mm_announcement_text').length ) {
clearInterval(waitForEditor);
attachEditorListeners();
} else if (tries > 30) { // about 3s
clearInterval(waitForEditor);
// still attach textarea event just in case
$('#mm_announcement_text').on('input change', updatePreviewTextFromEditor);
}
}, 100);
// Also update preview when the form is programmatically changed (e.g., quicktags)
$(document).on('change', '#mm-announcement-font, #mm-announcement-size, #mm-announcement-bg, #mm-announcement-color', function(){
updateSizeAndColors();
updatePreviewForFontKey($('#mm-announcement-font').val());
updatePreviewTextFromEditor();
});
});
})(jQuery);

View File

@@ -1,84 +1,84 @@
<?php <?php
/* /*
Template Name: Benutzerdefinierte Authentifizierungsseite Template Name: Benutzerdefinierte Authentifizierungsseite
*/ */
get_header(); ?> get_header(); ?>
<div class="container"> <div class="container">
<div id="primary" class="content-area"> <div id="primary" class="content-area">
<main id="main" class="site-main"> <main id="main" class="site-main">
<div class="custom-auth-container"> <div class="custom-auth-container">
<?php if (is_user_logged_in()) : ?> <?php if (is_user_logged_in()) : ?>
<!-- Wenn der Benutzer angemeldet ist, zeige eine Nachricht und einen Logout-Link --> <!-- Wenn der Benutzer angemeldet ist, zeige eine Nachricht und einen Logout-Link -->
<div class="logged-in-message"> <div class="logged-in-message">
<h2>Willkommen zurück, <?php echo esc_html(wp_get_current_user()->display_name); ?>!</h2> <h2>Willkommen zurück, <?php echo esc_html(wp_get_current_user()->display_name); ?>!</h2>
<p>Du bist bereits angemeldet.</p> <p>Du bist bereits angemeldet.</p>
<p> <p>
<a href="<?php echo esc_url(wp_logout_url(home_url())); ?>" class="button">Abmelden</a> <a href="<?php echo esc_url(wp_logout_url(home_url())); ?>" class="button">Abmelden</a>
<a href="<?php echo esc_url(admin_url()); ?>" class="button">Zum Dashboard</a> <a href="<?php echo esc_url(admin_url()); ?>" class="button">Zum Dashboard</a>
</p> </p>
</div> </div>
<?php else : ?> <?php else : ?>
<!-- Wenn der Benutzer nicht angemeldet ist, zeige das Registrierungsformular --> <!-- Wenn der Benutzer nicht angemeldet ist, zeige das Registrierungsformular -->
<h1 class="auth-title">Willkommen auf <?php bloginfo('name'); ?></h1> <h1 class="auth-title">Willkommen auf <?php bloginfo('name'); ?></h1>
<p class="auth-subtitle">Erstelle deinen Account und werde Teil unserer Community!</p> <p class="auth-subtitle">Erstelle deinen Account und werde Teil unserer Community!</p>
<?php <?php
// Zeige das Registrierungsformular an // Zeige das Registrierungsformular an
$args = array( $args = array(
'echo' => true, 'echo' => true,
'redirect' => home_url('/login/?checkemail=registered'), // Weiterleitung nach der Registrierung 'redirect' => home_url('/login/?checkemail=registered'), // Weiterleitung nach der Registrierung
'form_id' => 'custom_registerform', 'form_id' => 'custom_registerform',
'label_username' => __( 'Benutzername' ), 'label_username' => __( 'Benutzername' ),
'label_email' => __( 'E-Mail-Adresse' ), 'label_email' => __( 'E-Mail-Adresse' ),
'label_password' => __( 'Passwort' ), 'label_password' => __( 'Passwort' ),
'label_remember' => __( 'Angemeldet bleiben' ), 'label_remember' => __( 'Angemeldet bleiben' ),
'label_log_in' => __( 'Registrieren' ), 'label_log_in' => __( 'Registrieren' ),
'id_username' => 'user_login', 'id_username' => 'user_login',
'id_email' => 'user_email', 'id_email' => 'user_email',
'id_password' => 'user_pass', 'id_password' => 'user_pass',
'id_remember' => 'rememberme', 'id_remember' => 'rememberme',
'id_submit' => 'wp-submit', 'id_submit' => 'wp-submit',
'remember' => true, 'remember' => true,
'value_username' => NULL, 'value_username' => NULL,
'value_remember' => false 'value_remember' => false
); );
wp_register_form($args); wp_register_form($args);
?> ?>
<div class="login-form-link"> <div class="login-form-link">
<p>Schon hast du einen Account? <a href="<?php echo esc_url(wp_login_url()); ?>">Hier anmelden</a>.</p> <p>Schon hast du einen Account? <a href="<?php echo esc_url(wp_login_url()); ?>">Hier anmelden</a>.</p>
</div> </div>
<?php endif; ?> <?php endif; ?>
</div> </div>
</main> </main>
</div> </div>
</div> </div>
<?php <?php
// Hintergrundbild aus dem Customizer holen und als Inline-CSS ausgeben // Hintergrundbild aus dem Customizer holen und als Inline-CSS ausgeben
$auth_bg_image = get_theme_mod('login_background_image'); $auth_bg_image = get_theme_mod('login_background_image');
if ($auth_bg_image): if ($auth_bg_image):
?> ?>
<style> <style>
body.login, body.login-action-register { body.login, body.login-action-register {
background-image: url('<?php echo esc_url($auth_bg_image); ?>') !important; background-image: url('<?php echo esc_url($auth_bg_image); ?>') !important;
background-size: cover !important; background-size: cover !important;
background-position: center !important; background-position: center !important;
background-repeat: no-repeat !important; background-repeat: no-repeat !important;
} }
body.login::before, body.login-action-register::before { body.login::before, body.login-action-register::before {
content: ''; content: '';
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
background: rgba(20, 21, 26, 0.8); background: rgba(20, 21, 26, 0.8);
z-index: -1; z-index: -1;
} }
</style> </style>
<?php endif; ?> <?php endif; ?>
<?php get_footer(); ?> <?php get_footer(); ?>

View File

@@ -4,7 +4,7 @@ Theme URI: https://git.viper.ipv64.net/M_Viper/Minecraft-Modern-Theme
Author: M_Viper Author: M_Viper
Description: Ein modernes Gaming-Theme mit konfigurierbarem Header-Slider. Description: Ein modernes Gaming-Theme mit konfigurierbarem Header-Slider.
Author URI: https://M-Viper.de Author URI: https://M-Viper.de
Version: 1.5 Version: 1.6
License: GNU General Public License v2 or later License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: minecraft-modern-theme Text Domain: minecraft-modern-theme
@@ -73,7 +73,7 @@ a:hover { color: #fff; }
.site-header { .site-header {
background-color: var(--header-bg); background-color: var(--header-bg);
backdrop-filter: blur(10px); backdrop-filter: blur(10px);
padding: 15px 0; padding: 30px 0; /* FIX: Mehr vertikaler Platz im Header */
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 1000; z-index: 1000;
@@ -87,10 +87,15 @@ a:hover { color: #fff; }
.header-main { .header-main {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-start; justify-content: space-between; /* FIX: Logo Links, Menü Mitte, Info Rechts */
gap: 120px; /* Gleichmäßiger Abstand zwischen den Elementen */ gap: 40px; /* Flexiblerer Abstand */
} }
/* WICHTIG: Typo im Header.html korrigieren!
HTML: <div class="site-branding">
CSS: .site-branding
Sie müssen die 'g' im HTML oder CSS angleichen, sonst ist das Layout kaputt.
*/
.site-branding { .site-branding {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -117,12 +122,13 @@ a:hover { color: #fff; }
/* === NEUE DROPDOWN NAVIGATION ======================================= */ /* === NEUE DROPDOWN NAVIGATION ======================================= */
/* =================================================================== */ /* =================================================================== */
.main-navigation { #site-navigation {
position: relative; position: relative;
flex-grow: 1; flex-grow: 1; /* FIX: Navigation nimmt den gesamten Platz in der Mitte ein */
display: flex; display: flex;
justify-content: center; /* Zentriert das Menü */ justify-content: center; /* Zentriert das Menü innerhalb seines Raums */
align-items: center; align-items: center;
padding: 0 30px; /* Mindestabstand zu Logo und Socials */
} }
/* Hauptliste (Top Level) */ /* Hauptliste (Top Level) */
@@ -132,7 +138,7 @@ a:hover { color: #fff; }
list-style: none; list-style: none;
margin: 0; margin: 0;
padding: 0; padding: 0;
gap: 25px; gap: 20px; /* Abstand zwischen Menüpunkten horizontal */
} }
/* Menüpunkte */ /* Menüpunkte */
@@ -142,12 +148,12 @@ a:hover { color: #fff; }
/* Links in der Navigation */ /* Links in der Navigation */
.main-navigation a { .main-navigation a {
display: block; display: inline-block;
font-size: 15px; font-size: 15px;
font-weight: 600; font-weight: 600;
color: var(--text-muted); color: var(--text-muted);
text-decoration: none; text-decoration: none;
padding: 10px 0; padding: 20px 0; /* FIX: Mehr vertikaler Platz (Oben/Unten) ohne horizontales Padding */
transition: color 0.3s ease; transition: color 0.3s ease;
position: relative; position: relative;
} }
@@ -178,7 +184,7 @@ a:hover { color: #fff; }
top: 100%; /* Direkt unter dem Elternpunkt */ top: 100%; /* Direkt unter dem Elternpunkt */
left: 0; left: 0;
background-color: var(--surface-color); background-color: var(--surface-color);
border: 1px solid var(--border-color); border:1px solid var(--border-color);
border-top: 3px solid var(--primary-accent); border-top: 3px solid var(--primary-accent);
min-width: 240px; min-width: 240px;
list-style: none; list-style: none;
@@ -209,6 +215,12 @@ a:hover { color: #fff; }
border-bottom: 1px solid rgba(255,255,255,0.05); border-bottom: 1px solid rgba(255,255,255,0.05);
font-size: 14px; font-size: 14px;
white-space: nowrap; white-space: nowrap;
/* FIX: Vollständige Hintergrund-Markierung */
display: block;
width: 100%;
box-sizing: border-box; /* Padding wird zur Breite hinzugezählt */
transition: background-color 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
} }
.sub-menu li:last-child a { .sub-menu li:last-child a {
@@ -658,7 +670,7 @@ html.light-mode .icon-sun { opacity: 1; }
} }
.faq-answer p { margin-bottom: 20px; font-size: 0.9rem; } .faq-answer p { margin-bottom: 20px; font-size: 0.9rem; }
.faq-item.active .faq-answer { .faq-item.active .faq-answer {
padding: 0 20px 20px 20px; padding: 0 20px 20px;
max-height: 1000px; max-height: 1000px;
transition: max-height 0.4s ease-in, padding 0.4s ease-in; transition: max-height 0.4s ease-in, padding 0.4s ease-in;
} }
@@ -683,6 +695,7 @@ html.light-mode .icon-sun { opacity: 1; }
border: 1px solid var(--border-color); border: 1px solid var(--border-color);
padding: 40px; padding: 40px;
margin-bottom: 30px; margin-bottom: 30px;
margin-top: 40px;
} }
.faq-tabs { .faq-tabs {
@@ -881,7 +894,7 @@ main#primary.site-main {
.site-branding { flex-grow: 1; } .site-branding { flex-grow: 1; }
.header-info { order: 2; } /* Social rechts */ .header-info { order: 2; } /* Social rechts */
.main-navigation { order: 3; width: 100%; } #site-navigation { order: 3; width: 100%; }
.menu-toggle { .menu-toggle {
display: block; display: block;
@@ -902,13 +915,13 @@ main#primary.site-main {
} }
/* Wenn .toggled aktiv ist, zeigen */ /* Wenn .toggled aktiv ist, zeigen */
.main-navigation.toggled .primary-menu { #site-navigation.toggled .primary-menu {
display: flex; display: flex;
animation: slideDown 0.3s ease forwards; animation: slideDown 0.3s ease forwards;
} }
.menu-item { width: 100%; text-align: left; } .menu-item { width: 100%; text-align: left; }
.main-navigation a { padding: 15px 20px; } #site-navigation a { padding: 15px 20px; }
/* Submenus mobil - Akkordeon Style */ /* Submenus mobil - Akkordeon Style */
.sub-menu { .sub-menu {
@@ -949,8 +962,8 @@ main#primary.site-main {
.custom-logo-link img, .custom-logo { max-height: 50px; } .custom-logo-link img, .custom-logo { max-height: 50px; }
/* Hero */ /* Hero */
.hero-title, .slider-title { font-size: 32px; } .slider-title { font-size: 32px; }
.hero-subtitle, .slider-subtitle { font-size: 18px; } .slider-subtitle { font-size: 18px; }
.hero-buttons a { display: block; margin: 10px auto; width: 80%; } .hero-buttons a { display: block; margin: 10px auto; width: 80%; }
/* Footer Responsive */ /* Footer Responsive */
@@ -1006,4 +1019,268 @@ main#primary.site-main {
body.home-title-hidden .site-main .entry-header, body.home-title-hidden .site-main .entry-header,
body.home-title-hidden .site-main .page-header { body.home-title-hidden .site-main .page-header {
display: none !important; display: none !important;
}
/* Announcement Bar - basics */
#mm-announcement {
width: 100%;
position: relative;
z-index: 9999;
box-sizing: border-box;
transition: all 220ms ease;
}
/* Inner container centers text and keeps close button to the right */
.mm-announcement-inner {
max-width: 1400px;
margin: 0 auto;
padding: 12px 20px;
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
/* Text center */
.mm-announcement-text {
text-align: center;
line-height: 1.2;
}
/* Close button on the right edge of the inner container */
.mm-announcement-close {
position: absolute;
right: 20px;
top: 50%;
transform: translateY(-50%);
background: none;
border: none;
color: inherit;
font-size: 22px;
cursor: pointer;
padding: 6px;
line-height: 1;
}
/* Responsive tweaks */
@media (max-width: 600px) {
.mm-announcement-inner {
padding: 10px 12px;
}
.mm-announcement-close {
right: 12px;
font-size: 20px;
}
.mm-announcement-text { font-size: 14px; }
}
/* ==========================================================================
TEAM / STAFF SHOWCASE STYLES (AKTUALISIERT)
========================================================================== */
/* --- WICHTIG: Container Breite definieren ---
Das sorgt dafür, dass die Cards breiter werden können. */
.container {
max-width: 1500px; /* Von 1200px auf 1500px erhöht für breitere Karten */
margin: 0 auto;
padding: 0 20px;
width: 100%;
}
/* --- 1. Container Der Hintergrund-Karton --- */
.team-archive-container {
background-color: var(--card-bg);
border-radius: 8px;
border: 1px solid var(--border-color);
padding: 50px;
margin-bottom: 30px;
margin-top: 40px;
}
.page-header {
text-align: center;
margin-bottom: 50px;
}
.page-header .page-title {
font-size: 2.5rem;
color: var(--primary-accent);
text-transform: uppercase;
letter-spacing: 2px;
margin-bottom: 10px;
}
.page-header .page-description {
font-size: 1.2rem;
color: var(--text-muted);
}
/* --- 2. Grid Layout (FESTE 3 SPALTEN) --- */
.team-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 25px; /* Etwas weniger Abstand = Mehr Breite */
}
/* --- 3. Team Card Design (AKTUELL) --- */
.team-card {
background-color: transparent;
/* AKTUALISIERUNG: Border ist jetzt die Akzentfarbe (farbig) */
border: 1.5px solid var(--primary-accent);
border-radius: 12px;
overflow: visible; /* Avatar soll über den Rand ragen */
transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
position: relative;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
padding: 0 0 40px 0;
margin-top: 50px;
height: 70%;
width: 100%;
justify-content: space-between;
}
/* Hover Effekt */
.team-card:hover {
transform: translateY(-10px);
/* Border wird beim Hover auch heller oder die Glow-Farbe je nach Wunsch */
box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5), 0 0 25px rgba(0, 212, 255, 0.4);
}
/* --- 4. Runder Avatar (AKTUELL) --- */
.team-image-wrapper {
margin-top: -50px;
width: 150px;
height: 150px;
border-radius: 50%;
border: 5px solid var(--card-bg); /* Innerer Hintergrund-Rand */
/* WICHTIG: Hier ist KEIN box-shadow mehr (Kein dauerhafter Glow) */
overflow: hidden;
background-color: #000;
z-index: 2;
flex-shrink: 0;
/* Transition für den Hover-Effekt hinzugefügt */
transition: transform 0.5s ease, box-shadow 0.3s ease;
}
.team-image-wrapper img {
width: 100%;
height: 100%;
object-fit: cover;
}
/* --- NEU: Glow ONLY ON HOVER --- */
/* Wenn Maus auf die Karte fährt, bekommt der Avatar einen Glow */
.team-card:hover .team-image-wrapper {
/* Der Glow erscheint nur hier */
box-shadow: 0 0 0 6px var(--primary-accent);
}
/* Zusätzlich: Zoom-Effekt beim Hover (Optionale Verfeinerung) */
.team-card:hover .team-image-wrapper img {
transform: scale(1.05);
}
/* --- 5. Info Bereich --- */
.team-info {
padding: 15px 35px 0 35px;
width: 100%;
display: flex;
flex-direction: column;
flex-grow: 1;
}
.team-name {
margin: 20px 0 8px 0;
font-size: 1.8rem;
color: var(--text-color);
font-weight: 700;
line-height: 1.2;
min-height: 1.2em;
}
/* --- 6. Mehrere Ränge (Wrapper) --- */
.team-ranks-wrapper {
margin-bottom: 20px;
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 10px;
}
.team-rank {
display: inline-block;
background-color: rgba(0, 212, 255, 0.1);
color: var(--primary-accent);
padding: 6px 16px;
border-radius: 25px;
font-size: 0.85rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 1px;
border: 1px solid rgba(0, 212, 255, 0.3);
}
/* --- 7. Bio Text (Begrenzung & Styling) --- */
.team-bio {
font-size: 1rem;
color: var(--text-muted);
line-height: 1.6;
/* Füllt den restlichen Platz bis unten aus */
margin-top: auto;
/* Begrenzung auf max 4 Zeilen */
display: -webkit-box;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
/* Fallback für alte Browser */
max-height: 6.4em;
}
/* --- 8. Responsive Design (Tablet & Mobile) --- */
/* Tablet (2 Spalten) */
@media (max-width: 1100px) {
.team-grid {
grid-template-columns: repeat(2, 1fr);
gap: 30px;
}
.team-name { font-size: 1.6rem; }
}
/* Mobile (1 Spalte) */
@media (max-width: 768px) {
.container {
padding: 0 15px;
max-width: 100%;
}
.team-grid {
grid-template-columns: 1fr;
gap: 25px;
}
.team-archive-container {
padding: 30px 20px;
}
.team-name {
font-size: 1.5rem;
}
.team-image-wrapper {
width: 120px;
height: 120px;
margin-top: -40px;
}
} }