Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 903333cac3 | |||
| 446e08dc91 | |||
| 231cf8fc6c | |||
| 2f93e98220 | |||
| 43f19e926a | |||
| 41e46b8804 | |||
| aa07d5bda3 | |||
| 76218121a4 | |||
| 04424d7f59 | |||
| 98640766c6 | |||
| 3e911e5ab7 | |||
| 036fa2be08 | |||
| efdda0d8ed | |||
| 1b961d75bd | |||
| 8144180b8b | |||
| 5a6a035fe1 | |||
| 7cd7abdead | |||
| e87c3f6f97 | |||
| f25fbf3869 | |||
| 32bbb0b36f | |||
| 75af878db9 | |||
| 88dd9e8c45 | |||
| 5be3e02b7d | |||
| 91df9b2f6f | |||
| f9753124e1 | |||
| 4bfd56887c | |||
| 12c762794b |
BIN
Minecraft-Modern-Theme-Child/screenshot.PNG
Normal file
BIN
Minecraft-Modern-Theme-Child/screenshot.PNG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
276
Minecraft-Modern-Theme/css/login-style.css
Normal file
276
Minecraft-Modern-Theme/css/login-style.css
Normal file
@@ -0,0 +1,276 @@
|
||||
/* Minecraft Modern Theme Login & Registrierungs-Styles */
|
||||
body.login, body.login-action-register {
|
||||
background-color: #14151a; /* Fallback-Farbe */
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
font-family: 'Raleway', sans-serif;
|
||||
}
|
||||
|
||||
/* Dunkler Overlay für bessere Lesbarkeit */
|
||||
body.login::before, body.login-action-register::before {
|
||||
content: '';
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(20, 21, 26, 0.8);
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
/* Logo zentrieren */
|
||||
body.login h1, body.login-action-register h1 {
|
||||
text-align: center;
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
body.login h1 a, body.login-action-register h1 a {
|
||||
width: auto;
|
||||
height: 160px;
|
||||
background-size: contain;
|
||||
}
|
||||
|
||||
/* Haupt-Container, der alles umschließt */
|
||||
body.login #login, body.login-action-register #login {
|
||||
width: 80%;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
background: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* Der Wrapper, der vom Skript erstellt wird. */
|
||||
body.login #login-content-wrapper, body.login-action-register #login-content-wrapper {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
background-color: #252830;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Linke Spalte: Minecraft Avatar Slider (27.8%) */
|
||||
body.login #minecraft-avatar-slider, body.login-action-register #minecraft-avatar-slider {
|
||||
flex: 0 0 27.8%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 20px;
|
||||
padding-top: 50px;
|
||||
background-color: #1a1c23;
|
||||
height: auto;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body.login #minecraft-avatar-slider .avatar-slide, body.login-action-register #minecraft-avatar-slider .avatar-slide {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
border-radius: 4px;
|
||||
position: absolute;
|
||||
top: 25px;
|
||||
left: 0;
|
||||
opacity: 0;
|
||||
transition: opacity 0.7s ease-in-out;
|
||||
}
|
||||
|
||||
body.login #minecraft-avatar-slider .avatar-slide-active, body.login-action-register #minecraft-avatar-slider .avatar-slide-active {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* Rechte Spalte: Login/Registrierungs-Formular (72.2%) */
|
||||
body.login #loginform, body.login-action-register #registerform, body.login #loginform, body.login-action-register #registerform {
|
||||
flex: 1;
|
||||
padding: 40px;
|
||||
background: none;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* Formular-Felder */
|
||||
body.login #loginform p, body.login-action-register #registerform p,
|
||||
body.login #loginform label, body.login-action-register #registerform label {
|
||||
margin-bottom: 20px;
|
||||
color: #e4e4e4;
|
||||
font-weight: 600;
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
body.login #loginform input[type="text"], body.login #loginform input[type="password"], body.login-action-register #registerform input[type="text"], body.login-action-register #registerform input[type="password"], body.login #loginform input[type="email"], body.login-action-register #registerform input[type="email"] {
|
||||
width: 100%;
|
||||
padding: 14px;
|
||||
background-color: #1e2029;
|
||||
border: 1px solid #333;
|
||||
border-radius: 4px;
|
||||
color: #e4e4e4;
|
||||
font-family: 'Raleway', sans-serif;
|
||||
font-size: 16px;
|
||||
transition: border-color 0.3s, box-shadow 0.3s;
|
||||
}
|
||||
|
||||
body.login #loginform input[type="text"]:focus, body.login #loginform input[type="password"]:focus, body.login-action-register #registerform input[type="text"]:focus, body.login-action-register #registerform input[type="password"]:focus, body.login-action-register #registerform input[type="email"]:focus {
|
||||
border-color: #00d4ff;
|
||||
box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* "Angemeldet bleiben" Checkbox (nur Login) */
|
||||
body.login .forgetmenot label, body.login .forgetmenot input[type="checkbox"] {
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
color: #a0a0a0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
body.login .forgetmenot input[type="checkbox"] {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
/* NEU: Stile für die Registrierungsseite */
|
||||
.auth-title {
|
||||
text-align: center;
|
||||
color: #e4e4e4;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.auth-subtitle {
|
||||
text-align: center;
|
||||
color: #a0a0a0;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.login-form-link {
|
||||
text-align: center;
|
||||
margin-top: 30px;
|
||||
}
|
||||
.login-form-link p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.login-form-link a {
|
||||
color: #00d4ff;
|
||||
text-decoration: none;
|
||||
font-weight: 600;
|
||||
}
|
||||
.login-form-link a:hover {
|
||||
color: #fff;
|
||||
}
|
||||
.logged-in-message {
|
||||
text-align: center;
|
||||
padding: 40px;
|
||||
background-color: #252830;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
.logged-in-message h2 {
|
||||
margin-top: 0;
|
||||
color: #00d4ff;
|
||||
}
|
||||
.logged-in-message .button {
|
||||
display: inline-block;
|
||||
margin: 10px;
|
||||
padding: 12px 25px;
|
||||
background-color: #00d4ff;
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
border-radius: 4px;
|
||||
font-weight: 600;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
.logged-in-message .button:hover {
|
||||
background-color: #00a8cc;
|
||||
}
|
||||
|
||||
/* Container für "Angemeldet bleiben" und "Passwort vergessen" (nur Login) */
|
||||
body.login .login-options-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
body.login .login-options-container .forgetmenot,
|
||||
body.login .login-options-container #nav {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
body.login .login-options-container #nav a {
|
||||
color: #a0a0a0;
|
||||
text-decoration: none;
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
body.login .login-options-container #nav a:hover {
|
||||
color: #00d4ff;
|
||||
}
|
||||
|
||||
/* Submit-Button (gilt für Login & Registrierung) */
|
||||
body.login #loginform .submit input[type="submit"], body.login-action-register #registerform .submit input[type="submit"] {
|
||||
width: 100%;
|
||||
padding: 14px;
|
||||
background-color: #00d4ff;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
color: #fff;
|
||||
font-family: 'Raleway', sans-serif;
|
||||
font-weight: 600;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
body.login #loginform .submit input[type="submit"]:hover, body.login-action-register #registerform .submit input[type="submit"]:hover {
|
||||
background-color: #00a8cc;
|
||||
}
|
||||
|
||||
/* Anpassungen für kleinere Bildschirme */
|
||||
@media screen and (max-width: 768px) {
|
||||
body.login #login-content-wrapper, body.login-action-register #login-content-wrapper {
|
||||
flex-direction: column;
|
||||
}
|
||||
body.login #minecraft-avatar-slider, body.login-action-register #minecraft-avatar-slider {
|
||||
flex: none;
|
||||
width: 100%;
|
||||
padding: 30px;
|
||||
padding-top: 30px;
|
||||
}
|
||||
body.login #minecraft-avatar-slider .avatar-slide, body.login-action-register #minecraft-avatar-slider .avatar-slide {
|
||||
max-height: 300px;
|
||||
max-width: 200px;
|
||||
top: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fehlermeldungen und Hinweise */
|
||||
body.login .message, body.login #login_error, body.login-action-register .message, body.login-action-register #login_error {
|
||||
background-color: rgba(0, 212, 255, 0.1);
|
||||
border-left: 4px solid #00d4ff;
|
||||
padding: 15px;
|
||||
margin-bottom: 20px;
|
||||
border-radius: 0 4px 4px 0;
|
||||
color: #e4e4e4;
|
||||
}
|
||||
|
||||
/* =========================================================================
|
||||
=== STIL FÜR DIE LINKS UNTER DEM ANMELDE-BUTTON ====================
|
||||
========================================================================= */
|
||||
|
||||
body.login .post-login-links, body.login-action-register .post-login-links {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 15px;
|
||||
padding-top: 15px;
|
||||
border-top: 1px solid #333;
|
||||
}
|
||||
|
||||
body.login .post-login-links a, body.login-action-register .post-login-links a {
|
||||
color: #a0a0a0;
|
||||
text-decoration: none;
|
||||
font-size: 14px;
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
|
||||
body.login .post-login-links a:hover, body.login-action-register .post-login-links a:hover {
|
||||
color: #00d4ff;
|
||||
}
|
||||
@@ -1,80 +1,92 @@
|
||||
<?php get_header(); ?>
|
||||
|
||||
<?php
|
||||
if ( get_theme_mod('slider_enabled', false) ) :
|
||||
?>
|
||||
<section class="hero-slider swiper-container">
|
||||
<div class="swiper-wrapper">
|
||||
<?php
|
||||
for ($i = 1; $i <= 5; $i++) :
|
||||
$image_url = get_theme_mod('slider_image_' . $i);
|
||||
if ($image_url) :
|
||||
$title = get_theme_mod('slider_title_' . $i);
|
||||
$subtitle = get_theme_mod('slider_subtitle_' . $i);
|
||||
?>
|
||||
<div class="swiper-slide" style="background-image: url('<?php echo esc_url($image_url); ?>');">
|
||||
<div class="slider-content">
|
||||
<?php if ($title) : ?>
|
||||
<h2 class="slider-title"><?php echo esc_html($title); ?></h2>
|
||||
<?php endif; ?>
|
||||
<?php if ($subtitle) : ?>
|
||||
<p class="slider-subtitle"><?php echo esc_html($subtitle); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
endfor;
|
||||
?>
|
||||
</div>
|
||||
<div class="swiper-pagination"></div>
|
||||
<div class="swiper-button-prev"></div>
|
||||
<div class="swiper-button-next"></div>
|
||||
</section>
|
||||
<?php else : ?>
|
||||
<?php
|
||||
$hero_bg = get_theme_mod( 'hero_bg_image' );
|
||||
$hero_title = get_theme_mod( 'hero_title', 'Willkommen auf unserem Server' );
|
||||
$hero_subtitle = get_theme_mod( 'hero_subtitle', 'Trete einer Community voller Abenteuer bei.' );
|
||||
$btn1_text = get_theme_mod( 'hero_button_1_text', 'Zum Forum' );
|
||||
$btn1_url = get_theme_mod( 'hero_button_1_url', '#' );
|
||||
$btn2_text = get_theme_mod( 'hero_button_2_text', 'Zum Teamspeak' );
|
||||
$btn2_url = get_theme_mod( 'hero_button_2_url', '#' );
|
||||
?>
|
||||
<section class="hero-section" style="<?php echo $hero_bg ? "background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('" . esc_url($hero_bg) . "')" : ''; ?>">
|
||||
<div class="container">
|
||||
<h1 class="hero-title"><?php echo esc_html($hero_title); ?></h1>
|
||||
<p class="hero-subtitle"><?php echo esc_html($hero_subtitle); ?></p>
|
||||
<div class="hero-buttons">
|
||||
<a href="<?php echo esc_url($btn1_url); ?>" class="hero-button-1"><?php echo esc_html($btn1_text); ?></a>
|
||||
<a href="<?php echo esc_url($btn2_url); ?>" class="hero-button-2"><?php echo esc_html($btn2_text); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<main id="primary" class="site-main">
|
||||
<div class="container">
|
||||
<div class="content-area">
|
||||
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class('post'); ?>>
|
||||
<?php if ( has_post_thumbnail() ) : ?>
|
||||
<div class="post-thumbnail">
|
||||
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('medium_large'); ?></a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="post-content">
|
||||
<h2 class="post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
|
||||
<div class="post-excerpt">
|
||||
<?php the_excerpt(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<?php endwhile; else : ?>
|
||||
<p><?php _e( 'Keine Beiträge gefunden.', 'minecraft-modern-theme' ); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<?php get_header(); ?>
|
||||
|
||||
<?php
|
||||
if ( get_theme_mod('slider_enabled', false) ) :
|
||||
?>
|
||||
<section class="hero-slider swiper-container">
|
||||
<div class="swiper-wrapper">
|
||||
<?php
|
||||
for ($i = 1; $i <= 5; $i++) :
|
||||
$image_url = get_theme_mod('slider_image_' . $i);
|
||||
if ($image_url) :
|
||||
$title = get_theme_mod('slider_title_' . $i);
|
||||
$subtitle = get_theme_mod('slider_subtitle_' . $i);
|
||||
?>
|
||||
<div class="swiper-slide" style="background-image: url('<?php echo esc_url($image_url); ?>');">
|
||||
<div class="slider-content">
|
||||
<?php if ($title) : ?>
|
||||
<h2 class="slider-title"><?php echo esc_html($title); ?></h2>
|
||||
<?php endif; ?>
|
||||
<?php if ($subtitle) : ?>
|
||||
<p class="slider-subtitle"><?php echo esc_html($subtitle); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
endfor;
|
||||
?>
|
||||
</div>
|
||||
|
||||
<!-- Nur anzeigen, wenn die Paginierung NICHT ausgeblendet ist -->
|
||||
<?php if ( ! get_theme_mod('slider_hide_pagination', false) ) : ?>
|
||||
<div class="swiper-pagination"></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Nur anzeigen, wenn die Pfeile NICHT ausgeblendet sind -->
|
||||
<?php if ( ! get_theme_mod('slider_hide_arrows', false) ) : ?>
|
||||
<div class="swiper-button-prev"></div>
|
||||
<div class="swiper-button-next"></div>
|
||||
<?php endif; ?>
|
||||
|
||||
</section>
|
||||
<?php else : ?>
|
||||
<?php
|
||||
$hero_bg = get_theme_mod( 'hero_bg_image' );
|
||||
$hero_title = get_theme_mod( 'hero_title', 'Willkommen auf unserem Server' );
|
||||
$hero_subtitle = get_theme_mod( 'hero_subtitle', 'Trete einer Community voller Abenteuer bei.' );
|
||||
$btn1_text = get_theme_mod( 'hero_button_1_text', 'Zum Forum' );
|
||||
$btn1_url = get_theme_mod( 'hero_button_1_url', '#' );
|
||||
$btn2_text = get_theme_mod( 'hero_button_2_text', 'Zum Teamspeak' );
|
||||
$btn2_url = get_theme_mod( 'hero_button_2_url', '#' );
|
||||
?>
|
||||
<section class="hero-section" style="<?php echo $hero_bg ? "background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('" . esc_url($hero_bg) . "')" : ''; ?>">
|
||||
<div class="container">
|
||||
<h1 class="hero-title"><?php echo esc_html($hero_title); ?></h1>
|
||||
<p class="hero-subtitle"><?php echo esc_html($hero_subtitle); ?></p>
|
||||
<div class="hero-buttons">
|
||||
<a href="<?php echo esc_url($btn1_url); ?>" class="hero-button-1"><?php echo esc_html($btn1_text); ?></a>
|
||||
<a href="<?php echo esc_url($btn2_url); ?>" class="hero-button-2"><?php echo esc_html($btn2_text); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<main id="primary" class="site-main">
|
||||
<div class="container">
|
||||
<div class="content-area">
|
||||
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class('post'); ?>>
|
||||
<?php if ( has_post_thumbnail() ) : ?>
|
||||
<div class="post-thumbnail">
|
||||
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('medium_large'); ?></a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="post-content">
|
||||
<h2 class="post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
|
||||
<!-- =================================================================== -->
|
||||
<!-- === HIER IST DIE ÄNDERUNG: Vollen Inhalt anstelle des Auszugs === -->
|
||||
<!-- =================================================================== -->
|
||||
<div class="post-full-content">
|
||||
<?php the_content(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<?php endwhile; else : ?>
|
||||
<p><?php _e( 'Keine Beiträge gefunden.', 'minecraft-modern-theme' ); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
@@ -1,240 +1,417 @@
|
||||
<?php
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// === Theme Setup ===
|
||||
function minecraft_modern_setup() {
|
||||
add_theme_support( 'title-tag' );
|
||||
add_theme_support( 'post-thumbnails' );
|
||||
|
||||
// Logo-Unterstützung aktivieren (Maximale Flexibilität)
|
||||
add_theme_support( 'custom-logo', array(
|
||||
'height' => 9999, // Sehr hohe Werte, um den Crop-Dialog zu umgehen
|
||||
'width' => 9999, // Sehr hohe Werte, um den Crop-Dialog zu umgehen
|
||||
'flex-height' => true,
|
||||
'flex-width' => true,
|
||||
'header-text' => array( 'site-title', 'site-description' ),
|
||||
) );
|
||||
|
||||
// Benutzerdefinierten Hintergrund aktivieren
|
||||
add_theme_support( 'custom-background' );
|
||||
|
||||
register_nav_menus( array(
|
||||
'primary' => __( 'Hauptmenü', 'minecraft-modern-theme' ),
|
||||
'footer' => __( 'Footer-Menü', 'minecraft-modern-theme' ),
|
||||
) );
|
||||
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );
|
||||
}
|
||||
add_action( 'after_setup_theme', 'minecraft_modern_setup' );
|
||||
|
||||
// === Styles & Scripts laden ===
|
||||
function minecraft_modern_scripts() {
|
||||
// Haupt-Stylesheet
|
||||
wp_enqueue_style( 'minecraft-modern-style', get_stylesheet_uri() );
|
||||
|
||||
// Swiper.js CSS (von CDN)
|
||||
wp_enqueue_style( 'swiper-css', 'https://cdn.jsdelivr.net/npm/swiper@8/swiper-bundle.min.css' );
|
||||
|
||||
// JavaScript für den Header-Scroll-Effekt
|
||||
wp_enqueue_script(
|
||||
'minecraft-modern-header-script',
|
||||
get_template_directory_uri() . '/js/header-scroll.js',
|
||||
array(),
|
||||
'1.0',
|
||||
true
|
||||
);
|
||||
|
||||
// Swiper.js JS (von CDN)
|
||||
wp_enqueue_script(
|
||||
'swiper-js',
|
||||
'https://cdn.jsdelivr.net/npm/swiper@8/swiper-bundle.min.js',
|
||||
array(),
|
||||
'8.0.0',
|
||||
true
|
||||
);
|
||||
|
||||
// Unsere eigene Slider-Initialisierungs-Datei
|
||||
wp_enqueue_script(
|
||||
'minecraft-modern-slider-script',
|
||||
get_template_directory_uri() . '/js/slider-init.js',
|
||||
array('swiper-js'), // Hängt von Swiper.js ab
|
||||
'1.0',
|
||||
true
|
||||
);
|
||||
|
||||
// NEU: Theme-Toggle-Skript laden
|
||||
wp_enqueue_script(
|
||||
'theme-toggle-script',
|
||||
get_template_directory_uri() . '/js/theme-toggle.js',
|
||||
array(), // Keine Abhängigkeiten
|
||||
'1.0',
|
||||
true
|
||||
);
|
||||
|
||||
// FAQ Skript laden, wenn der Post-Type aktiv ist
|
||||
if ( post_type_exists('faq') ) {
|
||||
wp_enqueue_script(
|
||||
'faq-accordion-script',
|
||||
get_template_directory_uri() . '/js/faq-accordion.js',
|
||||
array(),
|
||||
'1.0',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
// Übergebe ALLE Theme-Einstellungen an das JavaScript
|
||||
// KORREKTUR: Der Objektname muss 'sliderSettings' bleiben, damit slider-init.js funktioniert.
|
||||
wp_localize_script(
|
||||
'minecraft-modern-slider-script',
|
||||
'sliderSettings',
|
||||
array(
|
||||
'hideArrows' => get_theme_mod( 'slider_hide_arrows', false ) ? '1' : '0',
|
||||
'hidePagination' => get_theme_mod( 'slider_hide_pagination', false ) ? '1' : '0',
|
||||
'defaultMode' => get_theme_mod( 'default_theme_mode', 'dark' ),
|
||||
'ajax_url' => admin_url('admin-ajax.php')
|
||||
)
|
||||
);
|
||||
|
||||
// === NEU & WICHTIG: Header-Skript-Informationen übergeben ===
|
||||
// Dies verhindert das Flackern im Customizer.
|
||||
wp_localize_script(
|
||||
'minecraft-modern-header-script', // <-- Richtiges Skript-Handle!
|
||||
'headerSettings', // <-- Neuer Objektname für Klarheit
|
||||
array(
|
||||
'isCustomizer' => is_customize_preview()
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'minecraft_modern_scripts' );
|
||||
|
||||
// === Customizer-Datei laden ===
|
||||
require get_template_directory() . '/inc/customizer.php';
|
||||
|
||||
// === Footer-Widgets registrieren ===
|
||||
function minecraft_modern_footer_widgets() {
|
||||
register_sidebar( array(
|
||||
'name' => __( 'Footer Links', 'minecraft-modern-theme' ),
|
||||
'id' => 'footer-left',
|
||||
'description' => __( 'Widget-Bereich links im Footer.', 'minecraft-modern-theme' ),
|
||||
'before_widget' => '<div id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h4 class="widget-title">',
|
||||
'after_title' => '</h4>',
|
||||
) );
|
||||
for ( $i = 1; $i <= 3; $i++ ) {
|
||||
register_sidebar( array(
|
||||
'name' => sprintf( __( 'Footer Spalte %d', 'minecraft-modern-theme' ), $i ),
|
||||
'id' => 'footer-' . $i,
|
||||
'description' => sprintf( __( 'Widget für die %d. Spalte im Footer.', 'minecraft-modern-theme' ), $i ),
|
||||
'before_widget' => '<div id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h4 class="widget-title">',
|
||||
'after_title' => '</h4>',
|
||||
) );
|
||||
}
|
||||
register_sidebar( array(
|
||||
'name' => __( 'Footer Rechts', 'minecraft-modern-theme' ),
|
||||
'id' => 'footer-right',
|
||||
'description' => __( 'Widget-Bereich rechts im Footer.', 'minecraft-modern-theme' ),
|
||||
'before_widget' => '<div id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h4 class="widget-title">',
|
||||
'after_title' => '</h4>',
|
||||
) );
|
||||
}
|
||||
add_action( 'widgets_init', 'minecraft_modern_footer_widgets' );
|
||||
|
||||
// === FAQ Custom Post Type & Taxonomy ===
|
||||
function create_faq_post_type() {
|
||||
// Nur registrieren, wenn im Customizer aktiviert
|
||||
if ( get_theme_mod( 'faq_enabled', true ) ) {
|
||||
register_post_type('faq',
|
||||
array(
|
||||
'labels' => array(
|
||||
'name' => __( 'FAQs', 'minecraft-modern-theme' ),
|
||||
'singular_name' => __( 'FAQ', 'minecraft-modern-theme' ),
|
||||
'add_new' => __( 'Neue FAQ hinzufügen', 'minecraft-modern-theme' ),
|
||||
'add_new_item' => __( 'Neue FAQ hinzufügen', 'minecraft-modern-theme' ),
|
||||
'edit_item' => __( 'FAQ bearbeiten', 'minecraft-modern-theme' ),
|
||||
'new_item' => __( 'Neue FAQ', 'minecraft-modern-theme' ),
|
||||
'view_item' => __( 'FAQ ansehen', 'minecraft-modern-theme' ),
|
||||
'search_items' => __( 'FAQs durchsuchen', 'minecraft-modern-theme' ),
|
||||
'not_found' => __( 'Keine FAQs gefunden', 'minecraft-modern-theme' ),
|
||||
'not_found_in_trash' => __( 'Keine FAQs im Papierkorb gefunden', 'minecraft-modern-theme' ),
|
||||
'all_items' => __( 'Alle FAQs', 'minecraft-modern-theme' ),
|
||||
),
|
||||
'public' => true,
|
||||
'has_archive' => true, // Archiv-Seite /faq/ bleibt als Fallback
|
||||
'menu_icon' => 'dashicons-format-chat',
|
||||
'supports' => array( 'title', 'editor', 'page-attributes' ),
|
||||
'rewrite' => array( 'slug' => 'faq' ),
|
||||
'show_in_rest' => true,
|
||||
)
|
||||
);
|
||||
register_taxonomy(
|
||||
'faq_category',
|
||||
'faq',
|
||||
array(
|
||||
'label' => __( 'FAQ Kategorien', 'minecraft-modern-theme' ),
|
||||
'rewrite' => array( 'slug' => 'faq-kategorie' ),
|
||||
'hierarchical' => true,
|
||||
'show_in_rest' => true,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
add_action('init', 'create_faq_post_type');
|
||||
|
||||
|
||||
// =============================================================================
|
||||
// NEU: Automatische FAQ-Seitenerstellung und Template-Zuweisung
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* Erstellt automatisch eine "FAQ" Seite, wenn die FAQ-Funktion aktiviert wird.
|
||||
*/
|
||||
function create_faq_page_automatically() {
|
||||
// Prüfen, ob die FAQ-Funktion aktiv ist
|
||||
if ( get_theme_mod( 'faq_enabled', true ) ) {
|
||||
// Prüfen, ob die Seite bereits existiert
|
||||
if ( get_page_by_title( 'FAQ' ) == null ) {
|
||||
// Seite erstellen
|
||||
$new_page = array(
|
||||
'post_title' => 'FAQ',
|
||||
'post_content' => 'Diese Seite zeigt alle FAQs an. Der Inhalt wird automatisch generiert.',
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'page',
|
||||
'post_author' => 1,
|
||||
);
|
||||
// Seite in die Datenbank einfügen
|
||||
wp_insert_post( $new_page );
|
||||
}
|
||||
}
|
||||
}
|
||||
// Diese Funktion wird ausgeführt, wenn der Customizer gespeichert wird.
|
||||
add_action( 'customize_save_after', 'create_faq_page_automatically' );
|
||||
|
||||
|
||||
/**
|
||||
* Leitet Anfragen für die "FAQ" Seite auf unser spezielles Template um.
|
||||
*/
|
||||
function load_faq_page_template( $template ) {
|
||||
// Prüfen, ob die FAQ-Funktion aktiv ist
|
||||
if ( get_theme_mod( 'faq_enabled', true ) ) {
|
||||
// Prüfen, ob wir uns auf einer Seite befinden
|
||||
if ( is_page() ) {
|
||||
global $post;
|
||||
// Prüfen, ob der Titel der Seite "FAQ" ist
|
||||
if ( $post && $post->post_title == 'FAQ' ) {
|
||||
// Pfad zu unserem Template zurückgeben
|
||||
return get_template_directory() . '/archive-faq.php';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Standard-Template in allen anderen Fällen
|
||||
return $template;
|
||||
}
|
||||
add_filter( 'template_include', 'load_faq_page_template' );
|
||||
<?php
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// === Theme Setup ===
|
||||
function minecraft_modern_setup() {
|
||||
add_theme_support( 'title-tag' );
|
||||
add_theme_support( 'post-thumbnails' );
|
||||
|
||||
// Logo-Unterstützung aktivieren (Maximale Flexibilität)
|
||||
add_theme_support( 'custom-logo', array(
|
||||
'height' => 9999, // Sehr hohe Werte, um den Crop-Dialog zu umgehen
|
||||
'width' => 9999, // Sehr hohe Werte, um den Crop-Dialog zu umgehen
|
||||
'flex-height' => true,
|
||||
'flex-width' => true,
|
||||
'header-text' => array( 'site-title', 'site-description' ),
|
||||
) );
|
||||
|
||||
// Benutzerdefinierten Hintergrund aktivieren
|
||||
add_theme_support( 'custom-background' );
|
||||
|
||||
register_nav_menus( array(
|
||||
'primary' => __( 'Hauptmenü', 'minecraft-modern-theme' ),
|
||||
'footer' => __( 'Footer-Menü', 'minecraft-modern-theme' ),
|
||||
) );
|
||||
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );
|
||||
}
|
||||
add_action( 'after_setup_theme', 'minecraft_modern_setup' );
|
||||
|
||||
// === Styles & Scripts laden ===
|
||||
function minecraft_modern_scripts() {
|
||||
// Haupt-Stylesheet
|
||||
wp_enqueue_style( 'minecraft-modern-style', get_stylesheet_uri() );
|
||||
|
||||
// Swiper.js CSS (von CDN)
|
||||
wp_enqueue_style( 'swiper-css', 'https://cdn.jsdelivr.net/npm/swiper@8/swiper-bundle.min.css' );
|
||||
|
||||
// JavaScript für den Header-Scroll-Effekt
|
||||
wp_enqueue_script(
|
||||
'minecraft-modern-header-script',
|
||||
get_template_directory_uri() . '/js/header-scroll.js',
|
||||
array(),
|
||||
'1.0',
|
||||
true
|
||||
);
|
||||
|
||||
// NEU: Ankündigungs-Skript laden
|
||||
wp_enqueue_script(
|
||||
'announcement-script',
|
||||
get_template_directory_uri() . '/js/announcement.js',
|
||||
array(), // Keine Abhängigkeiten
|
||||
'1.0',
|
||||
true
|
||||
);
|
||||
|
||||
// Swiper.js JS (von CDN)
|
||||
wp_enqueue_script(
|
||||
'swiper-js',
|
||||
'https://cdn.jsdelivr.net/npm/swiper@8/swiper-bundle.min.js',
|
||||
array(),
|
||||
'8.0.0',
|
||||
true
|
||||
);
|
||||
|
||||
// Unsere eigene Slider-Initialisierungs-Datei
|
||||
wp_enqueue_script(
|
||||
'minecraft-modern-slider-script',
|
||||
get_template_directory_uri() . '/js/slider-init.js',
|
||||
array('swiper-js'), // Hängt von Swiper.js ab
|
||||
'1.0',
|
||||
true
|
||||
);
|
||||
|
||||
// NEU: Theme-Toggle-Skript laden
|
||||
wp_enqueue_script(
|
||||
'theme-toggle-script',
|
||||
get_template_directory_uri() . '/js/theme-toggle.js',
|
||||
array(), // Keine Abhängigkeiten
|
||||
'1.0',
|
||||
true
|
||||
);
|
||||
|
||||
// FAQ Skript laden, wenn der Post-Type aktiv ist
|
||||
if ( post_type_exists('faq') ) {
|
||||
wp_enqueue_script(
|
||||
'faq-accordion-script',
|
||||
get_template_directory_uri() . '/js/faq-accordion.js',
|
||||
array(),
|
||||
'1.0',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
// Übergebe ALLE Theme-Einstellungen an das JavaScript
|
||||
wp_localize_script(
|
||||
'minecraft-modern-slider-script',
|
||||
'sliderSettings',
|
||||
array(
|
||||
'hideArrows' => get_theme_mod( 'slider_hide_arrows', false ) ? '1' : '0',
|
||||
'hidePagination' => get_theme_mod( 'slider_hide_pagination', false ) ? '1' : '0',
|
||||
'effect' => get_theme_mod( 'slider_effect', 'fade' ),
|
||||
'direction' => get_theme_mod( 'slider_direction', 'horizontal' ),
|
||||
'defaultMode' => get_theme_mod( 'default_theme_mode', 'dark' ),
|
||||
'ajax_url' => admin_url('admin-ajax.php')
|
||||
)
|
||||
);
|
||||
|
||||
// === NEU & WICHTIG: Header-Skript-Informationen übergeben ===
|
||||
// Dies verhindert das Flackern im Customizer.
|
||||
wp_localize_script(
|
||||
'minecraft-modern-header-script', // <-- Richtiges Skript-Handle!
|
||||
'headerSettings', // <-- Neuer Objektname für Klarheit
|
||||
array(
|
||||
'isCustomizer' => is_customize_preview()
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'minecraft_modern_scripts' );
|
||||
|
||||
// === Customizer-Datei laden ===
|
||||
require get_template_directory() . '/inc/customizer.php';
|
||||
|
||||
// === Footer-Widgets registrieren ===
|
||||
function minecraft_modern_footer_widgets() {
|
||||
register_sidebar( array(
|
||||
'name' => __( 'Footer Links', 'minecraft-modern-theme' ),
|
||||
'id' => 'footer-left',
|
||||
'description' => __( 'Widget-Bereich links im Footer.', 'minecraft-modern-theme' ),
|
||||
'before_widget' => '<div id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h4 class="widget-title">',
|
||||
'after_title' => '</h4>',
|
||||
) );
|
||||
for ( $i = 1; $i <= 3; $i++ ) {
|
||||
register_sidebar( array(
|
||||
'name' => sprintf( __( 'Footer Spalte %d', 'minecraft-modern-theme' ), $i ),
|
||||
'id' => 'footer-' . $i,
|
||||
'description' => sprintf( __( 'Widget für die %d. Spalte im Footer.', 'minecraft-modern-theme' ), $i ),
|
||||
'before_widget' => '<div id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h4 class="widget-title">',
|
||||
'after_title' => '</h4>',
|
||||
) );
|
||||
}
|
||||
register_sidebar( array(
|
||||
'name' => __( 'Footer Rechts', 'minecraft-modern-theme' ),
|
||||
'id' => 'footer-right',
|
||||
'description' => __( 'Widget-Bereich rechts im Footer.', 'minecraft-modern-theme' ),
|
||||
'before_widget' => '<div id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h4 class="widget-title">',
|
||||
'after_title' => '</h4>',
|
||||
) );
|
||||
}
|
||||
add_action( 'widgets_init', 'minecraft_modern_footer_widgets' );
|
||||
|
||||
// === FAQ Custom Post Type & Taxonomy ===
|
||||
function create_faq_post_type() {
|
||||
// Nur registrieren, wenn im Customizer aktiviert
|
||||
if ( get_theme_mod( 'faq_enabled', true ) ) {
|
||||
register_post_type('faq',
|
||||
array(
|
||||
'labels' => array(
|
||||
'name' => __( 'FAQs', 'minecraft-modern-theme' ),
|
||||
'singular_name' => __( 'FAQ', 'minecraft-modern-theme' ),
|
||||
'add_new' => __( 'Neue FAQ hinzufügen', 'minecraft-modern-theme' ),
|
||||
'add_new_item' => __( 'Neue FAQ hinzufügen', 'minecraft-modern-theme' ),
|
||||
'edit_item' => __( 'FAQ bearbeiten', 'minecraft-modern-theme' ),
|
||||
'new_item' => __( 'Neue FAQ', 'minecraft-modern-theme' ),
|
||||
'view_item' => __( 'FAQ ansehen', 'minecraft-modern-theme' ),
|
||||
'search_items' => __( 'FAQs durchsuchen', 'minecraft-modern-theme' ),
|
||||
'not_found' => __( 'Keine FAQs gefunden', 'minecraft-modern-theme' ),
|
||||
'not_found_in_trash' => __( 'Keine FAQs im Papierkorb gefunden', 'minecraft-modern-theme' ),
|
||||
'all_items' => __( 'Alle FAQs', 'minecraft-modern-theme' ),
|
||||
),
|
||||
'public' => true,
|
||||
'has_archive' => true, // Archiv-Seite /faq/ bleibt als Fallback
|
||||
'menu_icon' => 'dashicons-format-chat',
|
||||
'supports' => array( 'title', 'editor', 'page-attributes' ),
|
||||
'rewrite' => array( 'slug' => 'faq' ),
|
||||
'show_in_rest' => true,
|
||||
)
|
||||
);
|
||||
register_taxonomy(
|
||||
'faq_category',
|
||||
'faq',
|
||||
array(
|
||||
'label' => __( 'FAQ Kategorien', 'minecraft-modern-theme' ),
|
||||
'rewrite' => array( 'slug' => 'faq-kategorie' ),
|
||||
'hierarchical' => true,
|
||||
'show_in_rest' => true,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
add_action('init', 'create_faq_post_type');
|
||||
|
||||
// =============================================================================
|
||||
// NEU: Automatische "Home" Seitenerstellung und Zuweisung (kombiniert)
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* Erstellt die "Home" Seite und weist sie automatisch als statische Startseite zu,
|
||||
* wenn das Theme aktiviert wird und noch keine Seite festgelegt ist.
|
||||
*/
|
||||
function set_static_front_page_automatically() {
|
||||
// Nur ausführen, wenn noch keine statische Seite als Startseite festgelegt ist
|
||||
if ( 'page' !== get_option( 'show_on_front' ) ) {
|
||||
|
||||
// Finde die "Home" Seite (oder erstelle sie, falls sie nicht existiert)
|
||||
$home_page = get_page_by_title( 'Home' );
|
||||
if ( ! $home_page ) {
|
||||
// Seite erstellen, falls sie nicht existiert
|
||||
$home_page_id = wp_insert_post( array(
|
||||
'post_title' => 'Home',
|
||||
'post_content' => 'Diese Seite dient als statische Startseite.',
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'page',
|
||||
'post_author' => 1,
|
||||
) );
|
||||
} else {
|
||||
$home_page_id = $home_page->ID;
|
||||
}
|
||||
|
||||
// Setze die Seite als statische Startseite
|
||||
if ( $home_page_id ) {
|
||||
update_option( 'show_on_front', 'page' );
|
||||
update_option( 'page_on_front', $home_page_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
add_action( 'after_switch_theme', 'set_static_front_page_automatically' );
|
||||
|
||||
|
||||
/**
|
||||
* Fügt eine Body-Klasse hinzu, um den Home-Titel per CSS auszublenden.
|
||||
*/
|
||||
function add_home_body_class( $classes ) {
|
||||
// Prüfen, ob wir auf der Startseite sind und die Einstellung zum Ausblenden aktiv ist
|
||||
if ( is_front_page() && !get_theme_mod( 'show_home_title', true ) ) {
|
||||
$classes[] = 'home-title-hidden';
|
||||
}
|
||||
return $classes;
|
||||
}
|
||||
add_filter( 'body_class', 'add_home_body_class' );
|
||||
|
||||
|
||||
// =============================================================================
|
||||
// Automatische FAQ-Seitenerstellung und Template-Zuweisung
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* Erstellt automatisch eine "FAQ" Seite, wenn die FAQ-Funktion aktiviert wird.
|
||||
*/
|
||||
function create_faq_page_automatically() {
|
||||
// Prüfen, ob die FAQ-Funktion aktiv ist
|
||||
if ( get_theme_mod( 'faq_enabled', true ) ) {
|
||||
// Prüfen, ob die Seite bereits existiert
|
||||
if ( get_page_by_title( 'FAQ' ) == null ) {
|
||||
// Seite erstellen
|
||||
$new_page = array(
|
||||
'post_title' => 'FAQ',
|
||||
'post_content' => 'Diese Seite zeigt alle FAQs an. Der Inhalt wird automatisch generiert.',
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'page',
|
||||
'post_author' => 1,
|
||||
);
|
||||
// Seite in die Datenbank einfügen
|
||||
wp_insert_post( $new_page );
|
||||
}
|
||||
}
|
||||
}
|
||||
// Diese Funktion wird ausgeführt, wenn der Customizer gespeichert wird.
|
||||
add_action( 'customize_save_after', 'create_faq_page_automatically' );
|
||||
|
||||
|
||||
/**
|
||||
* Leitet Anfragen für die "FAQ" Seite auf unser spezielles Template um.
|
||||
*/
|
||||
function load_faq_page_template( $template ) {
|
||||
// Prüfen, ob die FAQ-Funktion aktiv ist
|
||||
if ( get_theme_mod( 'faq_enabled', true ) ) {
|
||||
// Prüfen, ob wir uns auf einer Seite befinden
|
||||
if ( is_page() ) {
|
||||
global $post;
|
||||
// Prüfen, ob der Titel der Seite "FAQ" ist
|
||||
if ( $post && $post->post_title == 'FAQ' ) {
|
||||
// Pfad zu unserem Template zurückgeben
|
||||
return get_template_directory() . '/archive-faq.php';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Standard-Template in allen anderen Fällen
|
||||
return $template;
|
||||
}
|
||||
add_filter( 'template_include', 'load_faq_page_template' );
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// === CUSTOM LOGIN FUNCTIONS (KOMPLETT NEU & KORRIGIERT) ==========
|
||||
// =========================================================================
|
||||
|
||||
// Lädt alle notwendigen Styles und Scripts nur für die Login-Seite
|
||||
function minecraft_modern_login_assets() {
|
||||
// Lade die Login-spezifische CSS
|
||||
wp_enqueue_style('minecraft-modern-login-style', get_template_directory_uri() . '/css/login-style.css');
|
||||
|
||||
// Lade Font Awesome für Icons
|
||||
wp_enqueue_style('font-awesome', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css');
|
||||
|
||||
// Lade das JavaScript für den Avatar-Slider
|
||||
wp_enqueue_script('minecraft-avatar-slider-script', get_template_directory_uri() . '/js/login-slider.js', array('jquery'), '1.0', true);
|
||||
|
||||
// Lade das JavaScript, das die HTML-Struktur anpasst
|
||||
wp_enqueue_script('minecraft-modern-login-script', get_template_directory_uri() . '/js/login-script.js', array('jquery'), '1.0', true);
|
||||
|
||||
wp_add_inline_script('minecraft-modern-login-script', "
|
||||
jQuery(document).ready(function($) {
|
||||
$('.forgetmenot, #nav').wrapAll('<div class=\"login-options-container\"></div>');
|
||||
});
|
||||
");
|
||||
|
||||
// Übergebe die Slider-Geschwindigkeit aus dem Customizer an das JavaScript
|
||||
$slider_speed = get_theme_mod('login_avatar_slider_speed', 4); // Standard: 4 Sekunden
|
||||
wp_localize_script('minecraft-avatar-slider-script', 'avatarSliderSettings', array(
|
||||
'speed' => $slider_speed * 1000 // Umwandlung in Millisekunden für JS
|
||||
));
|
||||
|
||||
// Hintergrundbild und Logo als Inline-CSS hinzufügen
|
||||
$login_bg_image = get_theme_mod('login_background_image');
|
||||
if ($login_bg_image) {
|
||||
$custom_css = "body.login { background-image: url('{$login_bg_image}') !important; }";
|
||||
wp_add_inline_style('minecraft-modern-login-style', $custom_css);
|
||||
}
|
||||
$logo_url = get_theme_mod('login_logo');
|
||||
if ($logo_url) {
|
||||
$logo_css = ".login h1 a { background-image: url('{$logo_url}') !important; }";
|
||||
wp_add_inline_style('minecraft-modern-login-style', $logo_css);
|
||||
}
|
||||
}
|
||||
add_action('login_enqueue_scripts', 'minecraft_modern_login_assets');
|
||||
|
||||
// Erstellt die HTML-Struktur für den Avatar-Slider
|
||||
function add_minecraft_avatar_slider_to_login() {
|
||||
$avatar_html = '<div id="minecraft-avatar-slider">';
|
||||
$has_avatars = false;
|
||||
|
||||
// Durchlaufe alle 5 möglichen Avatar-Plätze
|
||||
for ($i = 1; $i <= 5; $i++) {
|
||||
$uuid = get_theme_mod('login_avatar_uuid_' . $i);
|
||||
if (!empty($uuid)) {
|
||||
$has_avatars = true;
|
||||
$avatar_url = "https://visage.surgeplay.com/full/{$uuid}.png";
|
||||
// Das erste Bild wird direkt angezeigt
|
||||
$active_class = ($i === 1) ? 'avatar-slide-active' : '';
|
||||
$avatar_html .= '<img class="avatar-slide ' . esc_attr($active_class) . '" src="' . esc_url($avatar_url) . '" alt="Minecraft Avatar ' . ($i + 1) . '">';
|
||||
}
|
||||
}
|
||||
$avatar_html .= '</div>';
|
||||
|
||||
// Nur den Slider ausgeben, wenn mindestens ein Avatar hinterlegt wurde
|
||||
if ($has_avatars) {
|
||||
echo $avatar_html;
|
||||
}
|
||||
}
|
||||
add_action('login_form', 'add_minecraft_avatar_slider_to_login');
|
||||
|
||||
function add_post_login_links() {
|
||||
?>
|
||||
<div class="post-login-links">
|
||||
<a href="<?php echo esc_url(home_url()); ?>">← Zu <?php bloginfo('name'); ?></a>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
add_action('login_form_bottom', 'add_post_login_links');
|
||||
|
||||
// Entfernt unnötige Elemente von der Login-Seite
|
||||
function customize_login_page() {
|
||||
add_filter('login_display_language_dropdown', '__return_false');
|
||||
add_filter('login_display_back_to_blog', '__return_false');
|
||||
}
|
||||
add_action('login_head', 'customize_login_page');
|
||||
|
||||
// Passt Login-URL und Titel an
|
||||
function custom_login_url() { return home_url(); }
|
||||
add_filter('login_headerurl', 'custom_login_url');
|
||||
function custom_login_title() { return get_bloginfo('name'); }
|
||||
add_filter('login_headertext', 'custom_login_title');
|
||||
|
||||
// =========================================================================
|
||||
// === SCROLL TO TOP BUTTON ===============================================
|
||||
// =========================================================================
|
||||
|
||||
// Fügt den HTML-Code für den Button zum Footer hinzu
|
||||
function add_scroll_to_top_button() {
|
||||
?>
|
||||
<a href="#" id="scroll-to-top" title="Nach oben scrollen">
|
||||
<i class="fas fa-chevron-up"></i>
|
||||
</a>
|
||||
<?php
|
||||
}
|
||||
add_action('wp_footer', 'add_scroll_to_top_button');
|
||||
|
||||
// Lädt das JavaScript für den Scroll-to-Top Button
|
||||
function minecraft_modern_scroll_to_top_script() {
|
||||
wp_enqueue_script(
|
||||
'minecraft-scroll-to-top-script',
|
||||
get_template_directory_uri() . '/js/scroll-to-top.js',
|
||||
array('jquery'),
|
||||
'1.0',
|
||||
true
|
||||
);
|
||||
}
|
||||
add_action('wp_enqueue_scripts', 'minecraft_modern_scroll_to_top_script');
|
||||
@@ -1,67 +1,65 @@
|
||||
<!DOCTYPE html>
|
||||
<html <?php language_attributes(); ?>>
|
||||
<head>
|
||||
<meta charset="<?php bloginfo( 'charset' ); ?>">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
||||
<?php wp_head(); ?>
|
||||
</head>
|
||||
<body <?php body_class(); ?>>
|
||||
<header id="masthead" class="site-header">
|
||||
<div class="container">
|
||||
<div class="header-main">
|
||||
<div class="site-branding">
|
||||
<?php
|
||||
// Zeigt das Logo an, wenn eines vorhanden ist.
|
||||
if ( function_exists( 'the_custom_logo' ) && has_custom_logo() ) {
|
||||
the_custom_logo();
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
// Zeigt den Titel der Website IMMER an.
|
||||
// Verwendet <h1> auf der Startseite, sonst <p> für bessere SEO.
|
||||
if ( is_front_page() && is_home() ) :
|
||||
?>
|
||||
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
|
||||
<?php else : ?>
|
||||
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<nav id="site-navigation" class="main-navigation">
|
||||
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'container' => false ) ); ?>
|
||||
</nav>
|
||||
<div class="header-info">
|
||||
<div class="social-links">
|
||||
<?php
|
||||
// Array mit den Social-Media-Plattformen und ihren Font Awesome Klassen
|
||||
$social_icons = array(
|
||||
'discord' => 'fab fa-discord',
|
||||
'youtube' => 'fab fa-youtube',
|
||||
'twitter' => 'fab fa-x-twitter', // Neues Icon für Twitter/X
|
||||
'facebook' => 'fab fa-facebook-f',
|
||||
'instagram' => 'fab fa-instagram',
|
||||
'tiktok' => 'fab fa-tiktok',
|
||||
'twitch' => 'fab fa-twitch',
|
||||
'steam' => 'fab fa-steam',
|
||||
'github' => 'fab fa-github',
|
||||
'linkedin' => 'fab fa-linkedin-in',
|
||||
'pinterest' => 'fab fa-pinterest-p',
|
||||
'reddit' => 'fab fa-reddit-alien',
|
||||
'teamspeak' => 'fab fa-teamspeak',
|
||||
'spotify' => 'fab fa-spotify'
|
||||
);
|
||||
|
||||
// Schleife, die alle verfügbaren Icons durchgeht
|
||||
foreach ($social_icons as $key => $class) {
|
||||
// Prüfen, ob für diese Plattform eine URL im Customizer hinterlegt wurde
|
||||
if (get_theme_mod('social_' . $key)) {
|
||||
// Wenn ja, Link und Icon ausgeben
|
||||
echo '<a href="' . esc_url(get_theme_mod('social_' . $key)) . '" target="_blank"><i class="' . esc_attr($class) . '"></i></a>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!DOCTYPE html>
|
||||
<html <?php language_attributes(); ?>>
|
||||
<head>
|
||||
<meta charset="<?php bloginfo( 'charset' ); ?>">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
||||
<?php wp_head(); ?>
|
||||
</head>
|
||||
<body <?php body_class(); ?>>
|
||||
<header id="masthead" class="site-header">
|
||||
<div class="container">
|
||||
<div class="header-main">
|
||||
<div class="site-branding">
|
||||
<?php
|
||||
if ( function_exists( 'the_custom_logo' ) && has_custom_logo() ) {
|
||||
the_custom_logo();
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
|
||||
if ( is_front_page() && is_home() ) :
|
||||
?>
|
||||
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
|
||||
<?php else : ?>
|
||||
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<nav id="site-navigation" class="main-navigation">
|
||||
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'container' => false ) ); ?>
|
||||
</nav>
|
||||
<div class="header-info">
|
||||
<div class="social-links">
|
||||
<?php
|
||||
// Array mit den Social-Media-Plattformen und ihren Font Awesome Klassen
|
||||
$social_icons = array(
|
||||
'discord' => 'fab fa-discord',
|
||||
'youtube' => 'fab fa-youtube',
|
||||
'twitter' => 'fab fa-x-twitter', // Neues Icon für Twitter/X
|
||||
'facebook' => 'fab fa-facebook-f',
|
||||
'instagram' => 'fab fa-instagram',
|
||||
'tiktok' => 'fab fa-tiktok',
|
||||
'twitch' => 'fab fa-twitch',
|
||||
'steam' => 'fab fa-steam',
|
||||
'github' => 'fab fa-github',
|
||||
'linkedin' => 'fab fa-linkedin-in',
|
||||
'pinterest' => 'fab fa-pinterest-p',
|
||||
'reddit' => 'fab fa-reddit-alien',
|
||||
'teamspeak' => 'fab fa-teamspeak',
|
||||
'spotify' => 'fab fa-spotify'
|
||||
);
|
||||
|
||||
// Schleife, die alle verfügbaren Icons durchgeht
|
||||
foreach ($social_icons as $key => $class) {
|
||||
// Prüfen, ob für diese Plattform eine URL im Customizer hinterlegt wurde
|
||||
if (get_theme_mod('social_' . $key)) {
|
||||
// Wenn ja, Link und Icon ausgeben
|
||||
echo '<a href="' . esc_url(get_theme_mod('social_' . $key)) . '" target="_blank"><i class="' . esc_attr($class) . '"></i></a>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
@@ -1,258 +1,341 @@
|
||||
<?php
|
||||
|
||||
function minecraft_modern_customize_register( $wp_customize ) {
|
||||
|
||||
// =========================================================================
|
||||
// === 1. HEADER-BEREICH ===================================================
|
||||
// =========================================================================
|
||||
|
||||
// --- Sektion: Header Slider ---
|
||||
$wp_customize->add_section( 'header_slider', array(
|
||||
'title' => 'Header Slider',
|
||||
'priority' => 20,
|
||||
'description' => 'Konfiguriere den großen Slider auf der Startseite.',
|
||||
) );
|
||||
|
||||
// Checkbox zum Aktivieren des Sliders
|
||||
$wp_customize->add_setting( 'slider_enabled', array(
|
||||
'default' => false,
|
||||
'transport' => 'refresh',
|
||||
'sanitize_callback' => 'wp_validate_boolean',
|
||||
) );
|
||||
$wp_customize->add_control( 'slider_enabled', array(
|
||||
'label' => 'Header Slider aktivieren',
|
||||
'section' => 'header_slider',
|
||||
'settings' => 'slider_enabled',
|
||||
'type' => 'checkbox',
|
||||
) );
|
||||
|
||||
// Dynamische Slider-Bilder, Titel und Untertitel
|
||||
for ($i = 1; $i <= 5; $i++) {
|
||||
$wp_customize->add_setting( 'slider_image_' . $i, array( 'sanitize_callback' => 'esc_url_raw' ) );
|
||||
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'slider_image_' . $i, array(
|
||||
'label' => sprintf( 'Banner %d - Bild', $i ),
|
||||
'section' => 'header_slider',
|
||||
'settings' => 'slider_image_' . $i,
|
||||
) ) );
|
||||
|
||||
$wp_customize->add_setting( 'slider_title_' . $i, array( 'sanitize_callback' => 'sanitize_text_field' ) );
|
||||
$wp_customize->add_control( 'slider_title_' . $i, array(
|
||||
'label' => sprintf( 'Banner %d - Titel', $i ),
|
||||
'section' => 'header_slider',
|
||||
'settings' => 'slider_title_' . $i,
|
||||
'type' => 'text',
|
||||
) );
|
||||
|
||||
$wp_customize->add_setting( 'slider_subtitle_' . $i, array( 'sanitize_callback' => 'sanitize_text_field' ) );
|
||||
$wp_customize->add_control( 'slider_subtitle_' . $i, array(
|
||||
'label' => sprintf( 'Banner %d - Untertitel', $i ),
|
||||
'section' => 'header_slider',
|
||||
'settings' => 'slider_subtitle_' . $i,
|
||||
'type' => 'text',
|
||||
) );
|
||||
}
|
||||
|
||||
// Slider Text- & Stil-Einstellungen
|
||||
$wp_customize->add_setting( 'slider_font_family', array( 'default' => 'Raleway', 'sanitize_callback' => 'sanitize_text_field' ) );
|
||||
$wp_customize->add_control( 'slider_font_family', array(
|
||||
'label' => 'Schriftart', 'section' => 'header_slider', 'settings' => 'slider_font_family', 'type' => 'select',
|
||||
'choices' => array( 'Raleway' => 'Raleway', 'Poppins' => 'Poppins', 'Montserrat' => 'Montserrat', 'Oswald' => 'Oswald', 'Roboto' => 'Roboto', 'Lato' => 'Lato' ),
|
||||
) );
|
||||
$wp_customize->add_setting( 'slider_font_size', array( 'default' => 'mittel', 'sanitize_callback' => 'sanitize_text_field' ) );
|
||||
$wp_customize->add_control( 'slider_font_size', array(
|
||||
'label' => 'Schriftgröße', 'section' => 'header_slider', 'settings' => 'slider_font_size', 'type' => 'select',
|
||||
'choices' => array( 'klein' => 'Klein', 'mittel' => 'Mittel', 'gross' => 'Groß', 'extra-gross' => 'Extra Groß' ),
|
||||
) );
|
||||
$wp_customize->add_setting( 'slider_font_color', array( 'default' => '#ffffff', 'sanitize_callback' => 'sanitize_hex_color' ) );
|
||||
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'slider_font_color', array(
|
||||
'label' => 'Schriftfarbe', 'section' => 'header_slider', 'settings' => 'slider_font_color',
|
||||
) ) );
|
||||
|
||||
// === VERGESSENE EINSTELLUNG WIEDER HINZUGEFÜGT ===
|
||||
$wp_customize->add_setting( 'header_height', array( 'default' => 'mittel', 'sanitize_callback' => 'sanitize_text_field' ) );
|
||||
$wp_customize->add_control( 'header_height', array(
|
||||
'label' => 'Header-Höhe', 'section' => 'header_slider', 'settings' => 'header_height', 'type' => 'select',
|
||||
'choices' => array( 'klein' => 'Klein', 'mittel' => 'Mittel', 'gross' => 'Groß' ),
|
||||
) );
|
||||
|
||||
$wp_customize->add_setting( 'slider_hide_arrows', array( 'default' => false, 'sanitize_callback' => 'wp_validate_boolean' ) );
|
||||
$wp_customize->add_control( 'slider_hide_arrows', array(
|
||||
'label' => 'Pfeile ausblenden', 'section' => 'header_slider', 'settings' => 'slider_hide_arrows', 'type' => 'checkbox',
|
||||
) );
|
||||
$wp_customize->add_setting( 'slider_hide_pagination', array( 'default' => false, 'sanitize_callback' => 'wp_validate_boolean' ) );
|
||||
$wp_customize->add_control( 'slider_hide_pagination', array(
|
||||
'label' => 'Paginierung (Punkte) ausblenden', 'section' => 'header_slider', 'settings' => 'slider_hide_pagination', 'type' => 'checkbox',
|
||||
) );
|
||||
|
||||
|
||||
// --- Sektion: Startseiten-Hero (Fallback) ---
|
||||
$wp_customize->add_section( 'hero_section', array(
|
||||
'title' => 'Startseiten-Hero (wenn Slider deaktiviert)',
|
||||
'priority' => 21,
|
||||
'description' => 'Diese Inhalte werden angezeigt, wenn der Slider ausgeschaltet ist.',
|
||||
) );
|
||||
$wp_customize->add_setting( 'hero_title', array( 'default' => 'Willkommen auf unserem Server', 'sanitize_callback' => 'sanitize_text_field' ) );
|
||||
$wp_customize->add_control( 'hero_title', array( 'label' => 'Haupttitel', 'section' => 'hero_section', 'settings' => 'hero_title', 'type' => 'text' ) );
|
||||
$wp_customize->add_setting( 'hero_subtitle', array( 'default' => 'Trete einer Community voller Abenteuer bei.', 'sanitize_callback' => 'sanitize_text_field' ) );
|
||||
$wp_customize->add_control( 'hero_subtitle', array( 'label' => 'Untertitel', 'section' => 'hero_section', 'settings' => 'hero_subtitle', 'type' => 'text' ) );
|
||||
$wp_customize->add_setting( 'hero_bg_image', array( 'sanitize_callback' => 'esc_url_raw' ) );
|
||||
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'hero_bg_image', array(
|
||||
'label' => 'Hintergrundbild', 'section' => 'hero_section', 'settings' => 'hero_bg_image',
|
||||
) ) );
|
||||
$wp_customize->add_setting( 'hero_button_1_text', array( 'default' => 'Zum Forum', 'sanitize_callback' => 'sanitize_text_field' ) );
|
||||
$wp_customize->add_control( 'hero_button_1_text', array( 'label' => 'Button 1 Text', 'section' => 'hero_section', 'settings' => 'hero_button_1_text', 'type' => 'text' ) );
|
||||
$wp_customize->add_setting( 'hero_button_1_url', array( 'default' => '#', 'sanitize_callback' => 'esc_url_raw' ) );
|
||||
$wp_customize->add_control( 'hero_button_1_url', array( 'label' => 'Button 1 URL', 'section' => 'hero_section', 'settings' => 'hero_button_1_url', 'type' => 'url' ) );
|
||||
$wp_customize->add_setting( 'hero_button_2_text', array( 'default' => 'Zum Teamspeak', 'sanitize_callback' => 'sanitize_text_field' ) );
|
||||
$wp_customize->add_control( 'hero_button_2_text', array( 'label' => 'Button 2 Text', 'section' => 'hero_section', 'settings' => 'hero_button_2_text', 'type' => 'text' ) );
|
||||
$wp_customize->add_setting( 'hero_button_2_url', array( 'default' => '#', 'sanitize_callback' => 'esc_url_raw' ) );
|
||||
$wp_customize->add_control( 'hero_button_2_url', array( 'label' => 'Button 2 URL', 'section' => 'hero_section', 'settings' => 'hero_button_2_url', 'type' => 'url' ) );
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// === 2. FARBEN & DARSTELLUNG (KOMBINIERT) ================================
|
||||
// =========================================================================
|
||||
|
||||
// --- Sektion: Farben & Darstellung ---
|
||||
$wp_customize->add_section( 'theme_appearance_settings', array(
|
||||
'title' => 'Farben & Darstellung',
|
||||
'priority' => 30,
|
||||
) );
|
||||
|
||||
// Akzentfarbe
|
||||
$wp_customize->add_setting( 'primary_accent_color', array( 'default' => '#00d4ff', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'refresh' ) );
|
||||
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'primary_accent_color', array(
|
||||
'label' => 'Akzentfarbe', 'section' => 'theme_appearance_settings', 'settings' => 'primary_accent_color',
|
||||
) ) );
|
||||
|
||||
// Hintergrundfarbe
|
||||
$wp_customize->add_setting( 'background_color', array(
|
||||
'default' => '#ffffff',
|
||||
'sanitize_callback' => 'sanitize_hex_color',
|
||||
'transport' => 'refresh',
|
||||
) );
|
||||
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'background_color', array(
|
||||
'label' => 'Hintergrundfarbe',
|
||||
'section' => 'theme_appearance_settings',
|
||||
'settings' => 'background_color',
|
||||
) ) );
|
||||
|
||||
// Dark / Light Mode
|
||||
$wp_customize->add_setting( 'default_theme_mode', array( 'default' => 'dark', 'sanitize_callback' => 'sanitize_key' ) );
|
||||
$wp_customize->add_control( 'default_theme_mode', array(
|
||||
'label' => 'Standard-Theme-Modus', 'section' => 'theme_appearance_settings', 'type' => 'radio',
|
||||
'choices' => array( 'dark' => 'Dark Mode (Standard)', 'light' => 'Light Mode' ),
|
||||
) );
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// === 3. SOCIAL MEDIA =====================================================
|
||||
// =========================================================================
|
||||
|
||||
$wp_customize->add_section( 'social_links', array( 'title' => 'Social Media Links', 'priority' => 40 ) );
|
||||
$social_platforms = array( 'discord' => 'Discord', 'youtube' => 'YouTube', 'twitter' => 'Twitter (X)', 'facebook' => 'Facebook', 'instagram' => 'Instagram', 'tiktok' => 'TikTok', 'twitch' => 'Twitch', 'steam' => 'Steam', 'github' => 'GitHub', 'linkedin' => 'LinkedIn', 'pinterest' => 'Pinterest', 'reddit' => 'Reddit', 'teamspeak' => 'Teamspeak', 'spotify' => 'Spotify' );
|
||||
foreach ($social_platforms as $key => $label) {
|
||||
$wp_customize->add_setting( 'social_' . $key, array( 'sanitize_callback' => 'esc_url_raw' ) );
|
||||
$wp_customize->add_control( 'social_' . $key, array(
|
||||
'label' => $label . ' URL', 'section' => 'social_links', 'settings' => 'social_' . $key, 'type' => 'url',
|
||||
) );
|
||||
}
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// === 4. FOOTER-BEREICH ==================================================
|
||||
// =========================================================================
|
||||
|
||||
$wp_customize->add_section( 'footer_settings', array( 'title' => 'Footer-Einstellungen', 'priority' => 50 ) );
|
||||
|
||||
// Copyright-Text
|
||||
$wp_customize->add_setting( 'footer_copyright', array( 'default' => '© ' . date('Y') . ' ' . get_bloginfo('name'), 'sanitize_callback' => 'wp_kses_post' ) );
|
||||
$wp_customize->add_control( 'footer_copyright', array(
|
||||
'label' => 'Copyright-Text', 'section' => 'footer_settings', 'settings' => 'footer_copyright', 'type' => 'textarea',
|
||||
) );
|
||||
|
||||
// Impressum & Datenschutz Links
|
||||
$wp_customize->add_setting( 'footer_impressum_url', array( 'sanitize_callback' => 'esc_url_raw' ) );
|
||||
$wp_customize->add_control( 'footer_impressum_url', array(
|
||||
'label' => 'URL für Impressum', 'section' => 'footer_settings', 'settings' => 'footer_impressum_url', 'type' => 'url',
|
||||
) );
|
||||
$wp_customize->add_setting( 'footer_datenschutz_url', array( 'sanitize_callback' => 'esc_url_raw' ) );
|
||||
$wp_customize->add_control( 'footer_datenschutz_url', array(
|
||||
'label' => 'URL für Datenschutz', 'section' => 'footer_settings', 'settings' => 'footer_datenschutz_url', 'type' => 'url',
|
||||
) );
|
||||
|
||||
// Footer-Credit
|
||||
$wp_customize->add_setting( 'show_footer_credit', array( 'default' => true, 'sanitize_callback' => 'wp_validate_boolean' ) );
|
||||
$wp_customize->add_control( 'show_footer_credit', array(
|
||||
'label' => 'Footer-Credit ("Minecraft Theme Erstellt von...") anzeigen', 'section' => 'footer_settings', 'settings' => 'show_footer_credit', 'type' => 'checkbox',
|
||||
) );
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// === 5. ZUSÄTZLICHE FUNKTIONEN ==========================================
|
||||
// =========================================================================
|
||||
|
||||
// --- Sektion: FAQ Einstellungen ---
|
||||
$wp_customize->add_section( 'faq_settings', array( 'title' => 'FAQ Einstellungen', 'priority' => 60 ) );
|
||||
$wp_customize->add_setting( 'faq_enabled', array( 'default' => true, 'sanitize_callback' => 'wp_validate_boolean' ) );
|
||||
$wp_customize->add_control( 'faq_enabled', array(
|
||||
'label' => 'FAQ System aktivieren', 'section' => 'faq_settings', 'settings' => 'faq_enabled', 'type' => 'checkbox',
|
||||
) );
|
||||
|
||||
}
|
||||
add_action( 'customize_register', 'minecraft_modern_customize_register' );
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// === DYNAMISCHES CSS =====================================================
|
||||
// =========================================================================
|
||||
|
||||
// Diese Funktion bleibt unverändert, da sie bereits gut strukturiert ist.
|
||||
function minecraft_modern_dynamic_css_output() {
|
||||
$accent_color = get_theme_mod( 'primary_accent_color', '#00d4ff' );
|
||||
$slider_font = get_theme_mod( 'slider_font_family', 'Raleway' );
|
||||
$slider_color = get_theme_mod( 'slider_font_color', '#ffffff' );
|
||||
$slider_size_setting = get_theme_mod( 'slider_font_size', 'mittel' );
|
||||
$header_height_setting = get_theme_mod( 'header_height', 'mittel' ); // Diese Einstellung wird hier verwendet!
|
||||
|
||||
// Header-Höhe umwandeln
|
||||
$header_height_value = '300px';
|
||||
if ( $header_height_setting === 'klein' ) {
|
||||
$header_height_value = '200px';
|
||||
} elseif ( $header_height_setting === 'gross' ) {
|
||||
$header_height_value = '400px';
|
||||
}
|
||||
|
||||
// Schriftgrößen umwandeln
|
||||
$font_sizes = array(
|
||||
'klein' => array( 'title' => '2.5rem', 'subtitle' => '1.2rem' ),
|
||||
'mittel' => array( 'title' => '3.5rem', 'subtitle' => '1.4rem' ),
|
||||
'gross' => array( 'title' => '4.5rem', 'subtitle' => '1.6rem' ),
|
||||
'extra-gross' => array( 'title' => '5.5rem', 'subtitle' => '1.8rem' ),
|
||||
);
|
||||
$chosen_sizes = isset( $font_sizes[$slider_size_setting] ) ? $font_sizes[$slider_size_setting] : $font_sizes['mittel'];
|
||||
|
||||
$fonts_to_load = array($slider_font);
|
||||
$fonts_url = 'https://fonts.googleapis.com/css2?family=' . implode( ':wght@400;600;700&family=', $fonts_to_load ) . '&display=swap';
|
||||
?>
|
||||
|
||||
<link rel="stylesheet" href="<?php echo esc_url($fonts_url); ?>">
|
||||
<style type="text/css">
|
||||
:root {
|
||||
--primary-accent: <?php echo esc_attr($accent_color); ?>;
|
||||
--header-height: <?php echo esc_attr($header_height_value); ?>;
|
||||
}
|
||||
.slider-title, .slider-subtitle, .hero-title, .hero-subtitle, .hero-button-1, .hero-button-2 {
|
||||
font-family: '<?php echo esc_attr($slider_font); ?>', sans-serif;
|
||||
color: <?php echo esc_attr($slider_color); ?>;
|
||||
}
|
||||
.slider-title, .hero-title {
|
||||
font-size: <?php echo esc_attr($chosen_sizes['title']); ?>;
|
||||
}
|
||||
.slider-subtitle, .hero-subtitle {
|
||||
font-size: <?php echo esc_attr($chosen_sizes['subtitle']); ?>;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
add_action( 'wp_head', 'minecraft_modern_dynamic_css_output' );
|
||||
<?php
|
||||
|
||||
function minecraft_modern_customize_register( $wp_customize ) {
|
||||
|
||||
// =========================================================================
|
||||
// === 1. HEADER-BEREICH ===================================================
|
||||
// =========================================================================
|
||||
|
||||
// --- Sektion: Header Slider ---
|
||||
$wp_customize->add_section( 'header_slider', array(
|
||||
'title' => 'Header Slider',
|
||||
'priority' => 20,
|
||||
'description' => 'Konfiguriere den großen Slider auf der Startseite.',
|
||||
) );
|
||||
|
||||
// Checkbox zum Aktivieren des Sliders
|
||||
$wp_customize->add_setting( 'slider_enabled', array(
|
||||
'default' => false,
|
||||
'transport' => 'refresh',
|
||||
'sanitize_callback' => 'wp_validate_boolean',
|
||||
) );
|
||||
$wp_customize->add_control( 'slider_enabled', array(
|
||||
'label' => 'Header Slider aktivieren',
|
||||
'section' => 'header_slider',
|
||||
'settings' => 'slider_enabled',
|
||||
'type' => 'checkbox',
|
||||
) );
|
||||
|
||||
// Dynamische Slider-Bilder, Titel und Untertitel
|
||||
for ($i = 1; $i <= 5; $i++) {
|
||||
$wp_customize->add_setting( 'slider_image_' . $i, array( 'sanitize_callback' => 'esc_url_raw' ) );
|
||||
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'slider_image_' . $i, array(
|
||||
'label' => sprintf( 'Banner %d - Bild', $i ),
|
||||
'section' => 'header_slider',
|
||||
'settings' => 'slider_image_' . $i,
|
||||
) ) );
|
||||
|
||||
$wp_customize->add_setting( 'slider_title_' . $i, array( 'sanitize_callback' => 'sanitize_text_field' ) );
|
||||
$wp_customize->add_control( 'slider_title_' . $i, array(
|
||||
'label' => sprintf( 'Banner %d - Titel', $i ),
|
||||
'section' => 'header_slider',
|
||||
'settings' => 'slider_title_' . $i,
|
||||
'type' => 'text',
|
||||
) );
|
||||
|
||||
$wp_customize->add_setting( 'slider_subtitle_' . $i, array( 'sanitize_callback' => 'sanitize_text_field' ) );
|
||||
$wp_customize->add_control( 'slider_subtitle_' . $i, array(
|
||||
'label' => sprintf( 'Banner %d - Untertitel', $i ),
|
||||
'section' => 'header_slider',
|
||||
'settings' => 'slider_subtitle_' . $i,
|
||||
'type' => 'text',
|
||||
) );
|
||||
}
|
||||
|
||||
// Slider Text- & Stil-Einstellungen
|
||||
$wp_customize->add_setting( 'slider_font_family', array( 'default' => 'Raleway', 'sanitize_callback' => 'sanitize_text_field' ) );
|
||||
$wp_customize->add_control( 'slider_font_family', array(
|
||||
'label' => 'Schriftart', 'section' => 'header_slider', 'settings' => 'slider_font_family', 'type' => 'select',
|
||||
'choices' => array( 'Raleway' => 'Raleway', 'Poppins' => 'Poppins', 'Montserrat' => 'Montserrat', 'Oswald' => 'Oswald', 'Roboto' => 'Roboto', 'Lato' => 'Lato' ),
|
||||
) );
|
||||
$wp_customize->add_setting( 'slider_font_size', array( 'default' => 'mittel', 'sanitize_callback' => 'sanitize_text_field' ) );
|
||||
$wp_customize->add_control( 'slider_font_size', array(
|
||||
'label' => 'Schriftgröße', 'section' => 'header_slider', 'settings' => 'slider_font_size', 'type' => 'select',
|
||||
'choices' => array( 'klein' => 'Klein', 'mittel' => 'Mittel', 'gross' => 'Groß', 'extra-gross' => 'Extra Groß' ),
|
||||
) );
|
||||
$wp_customize->add_setting( 'slider_font_color', array( 'default' => '#ffffff', 'sanitize_callback' => 'sanitize_hex_color' ) );
|
||||
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'slider_font_color', array(
|
||||
'label' => 'Schriftfarbe', 'section' => 'header_slider', 'settings' => 'slider_font_color',
|
||||
) ) );
|
||||
|
||||
// === VERGESSENE EINSTELLUNG WIEDER HINZUGEFÜGT ===
|
||||
$wp_customize->add_setting( 'header_height', array( 'default' => 'mittel', 'sanitize_callback' => 'sanitize_text_field' ) );
|
||||
$wp_customize->add_control( 'header_height', array(
|
||||
'label' => 'Header-Höhe', 'section' => 'header_slider', 'settings' => 'header_height', 'type' => 'select',
|
||||
'choices' => array( 'klein' => 'Klein', 'mittel' => 'Mittel', 'gross' => 'Groß' ),
|
||||
) );
|
||||
|
||||
$wp_customize->add_setting( 'slider_hide_arrows', array( 'default' => false, 'sanitize_callback' => 'wp_validate_boolean' ) );
|
||||
$wp_customize->add_control( 'slider_hide_arrows', array(
|
||||
'label' => 'Pfeile ausblenden', 'section' => 'header_slider', 'settings' => 'slider_hide_arrows', 'type' => 'checkbox',
|
||||
) );
|
||||
$wp_customize->add_setting( 'slider_hide_pagination', array( 'default' => false, 'sanitize_callback' => 'wp_validate_boolean' ) );
|
||||
$wp_customize->add_control( 'slider_hide_pagination', array(
|
||||
'label' => 'Paginierung (Punkte) ausblenden', 'section' => 'header_slider', 'settings' => 'slider_hide_pagination', 'type' => 'checkbox',
|
||||
) );
|
||||
|
||||
// =========================================================================
|
||||
// === ENTFERNT: Slider-Effekt-Einstellungen ==============================
|
||||
// =========================================================================
|
||||
|
||||
// --- Sektion: Startseiten-Hero (Fallback) ---
|
||||
$wp_customize->add_section( 'hero_section', array(
|
||||
'title' => 'Startseiten-Hero (wenn Slider deaktiviert)',
|
||||
'priority' => 21,
|
||||
'description' => 'Diese Inhalte werden angezeigt, wenn der Slider ausgeschaltet ist.',
|
||||
) );
|
||||
$wp_customize->add_setting( 'hero_title', array( 'default' => 'Willkommen auf unserem Server', 'sanitize_callback' => 'sanitize_text_field' ) );
|
||||
$wp_customize->add_control( 'hero_title', array( 'label' => 'Haupttitel', 'section' => 'hero_section', 'settings' => 'hero_title', 'type' => 'text' ) );
|
||||
$wp_customize->add_setting( 'hero_subtitle', array( 'default' => 'Trete einer Community voller Abenteuer bei.', 'sanitize_callback' => 'sanitize_text_field' ) );
|
||||
$wp_customize->add_control( 'hero_subtitle', array( 'label' => 'Untertitel', 'section' => 'hero_section', 'settings' => 'hero_subtitle', 'type' => 'text' ) );
|
||||
$wp_customize->add_setting( 'hero_bg_image', array( 'sanitize_callback' => 'esc_url_raw' ) );
|
||||
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'hero_bg_image', array(
|
||||
'label' => 'Hintergrundbild', 'section' => 'hero_section', 'settings' => 'hero_bg_image',
|
||||
) ) );
|
||||
$wp_customize->add_setting( 'hero_button_1_text', array( 'default' => 'Zum Forum', 'sanitize_callback' => 'sanitize_text_field' ) );
|
||||
$wp_customize->add_control( 'hero_button_1_text', array( 'label' => 'Button 1 Text', 'section' => 'hero_section', 'settings' => 'hero_button_1_text', 'type' => 'text' ) );
|
||||
$wp_customize->add_setting( 'hero_button_1_url', array( 'default' => '#', 'sanitize_callback' => 'esc_url_raw' ) );
|
||||
$wp_customize->add_control( 'hero_button_1_url', array( 'label' => 'Button 1 URL', 'section' => 'hero_section', 'settings' => 'hero_button_1_url', 'type' => 'url' ) );
|
||||
$wp_customize->add_setting( 'hero_button_2_text', array( 'default' => 'Zum Teamspeak', 'sanitize_callback' => 'sanitize_text_field' ) );
|
||||
$wp_customize->add_control( 'hero_button_2_text', array( 'label' => 'Button 2 Text', 'section' => 'hero_section', 'settings' => 'hero_button_2_text', 'type' => 'text' ) );
|
||||
$wp_customize->add_setting( 'hero_button_2_url', array( 'default' => '#', 'sanitize_callback' => 'esc_url_raw' ) );
|
||||
$wp_customize->add_control( 'hero_button_2_url', array( 'label' => 'Button 2 URL', 'section' => 'hero_section', 'settings' => 'hero_button_2_url', 'type' => 'url' ) );
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// === 2. FARBEN & DARSTELLUNG (KOMBINIERT) ================================
|
||||
// =========================================================================
|
||||
|
||||
// --- Sektion: Farben & Darstellung ---
|
||||
$wp_customize->add_section( 'theme_appearance_settings', array(
|
||||
'title' => 'Farben & Darstellung',
|
||||
'priority' => 30,
|
||||
) );
|
||||
|
||||
// Akzentfarbe
|
||||
$wp_customize->add_setting( 'primary_accent_color', array( 'default' => '#00d4ff', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'refresh' ) );
|
||||
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'primary_accent_color', array(
|
||||
'label' => 'Akzentfarbe', 'section' => 'theme_appearance_settings', 'settings' => 'primary_accent_color',
|
||||
) ) );
|
||||
|
||||
// Hintergrundfarbe
|
||||
$wp_customize->add_setting( 'background_color', array(
|
||||
'default' => '#ffffff',
|
||||
'sanitize_callback' => 'sanitize_hex_color',
|
||||
'transport' => 'refresh',
|
||||
) );
|
||||
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'background_color', array(
|
||||
'label' => 'Hintergrundfarbe',
|
||||
'section' => 'theme_appearance_settings',
|
||||
'settings' => 'background_color',
|
||||
) ) );
|
||||
|
||||
// Dark / Light Mode
|
||||
$wp_customize->add_setting( 'default_theme_mode', array( 'default' => 'dark', 'sanitize_callback' => 'sanitize_key' ) );
|
||||
$wp_customize->add_control( 'default_theme_mode', array(
|
||||
'label' => 'Standard-Theme-Modus', 'section' => 'theme_appearance_settings', 'type' => 'radio',
|
||||
'choices' => array( 'dark' => 'Dark Mode (Standard)', 'light' => 'Light Mode' ),
|
||||
) );
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// === 3. SOCIAL MEDIA =====================================================
|
||||
// =========================================================================
|
||||
|
||||
$wp_customize->add_section( 'social_links', array( 'title' => 'Social Media Links', 'priority' => 40 ) );
|
||||
$social_platforms = array( 'discord' => 'Discord', 'youtube' => 'YouTube', 'twitter' => 'Twitter (X)', 'facebook' => 'Facebook', 'instagram' => 'Instagram', 'tiktok' => 'TikTok', 'twitch' => 'Twitch', 'steam' => 'Steam', 'github' => 'GitHub', 'linkedin' => 'LinkedIn', 'pinterest' => 'Pinterest', 'reddit' => 'Reddit', 'teamspeak' => 'Teamspeak', 'spotify' => 'Spotify' );
|
||||
foreach ($social_platforms as $key => $label) {
|
||||
$wp_customize->add_setting( 'social_' . $key, array( 'sanitize_callback' => 'esc_url_raw' ) );
|
||||
$wp_customize->add_control( 'social_' . $key, array(
|
||||
'label' => $label . ' URL', 'section' => 'social_links', 'settings' => 'social_' . $key, 'type' => 'url',
|
||||
) );
|
||||
}
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// === 4. FOOTER-BEREICH ==================================================
|
||||
// =========================================================================
|
||||
|
||||
$wp_customize->add_section( 'footer_settings', array( 'title' => 'Footer-Einstellungen', 'priority' => 50 ) );
|
||||
|
||||
// Copyright-Text
|
||||
$wp_customize->add_setting( 'footer_copyright', array( 'default' => '© ' . date('Y') . ' ' . get_bloginfo('name'), 'sanitize_callback' => 'wp_kses_post' ) );
|
||||
$wp_customize->add_control( 'footer_copyright', array(
|
||||
'label' => 'Copyright-Text', 'section' => 'footer_settings', 'settings' => 'footer_copyright', 'type' => 'textarea',
|
||||
) );
|
||||
|
||||
// Impressum & Datenschutz Links
|
||||
$wp_customize->add_setting( 'footer_impressum_url', array( 'sanitize_callback' => 'esc_url_raw' ) );
|
||||
$wp_customize->add_control( 'footer_impressum_url', array(
|
||||
'label' => 'URL für Impressum', 'section' => 'footer_settings', 'settings' => 'footer_impressum_url', 'type' => 'url',
|
||||
) );
|
||||
$wp_customize->add_setting( 'footer_datenschutz_url', array( 'sanitize_callback' => 'esc_url_raw' ) );
|
||||
$wp_customize->add_control( 'footer_datenschutz_url', array(
|
||||
'label' => 'URL für Datenschutz', 'section' => 'footer_settings', 'settings' => 'footer_datenschutz_url', 'type' => 'url',
|
||||
) );
|
||||
|
||||
// Footer-Credit
|
||||
$wp_customize->add_setting( 'show_footer_credit', array( 'default' => true, 'sanitize_callback' => 'wp_validate_boolean' ) );
|
||||
$wp_customize->add_control( 'show_footer_credit', array(
|
||||
'label' => 'Footer-Credit ("Minecraft Theme Erstellt von...") anzeigen', 'section' => 'footer_settings', 'settings' => 'show_footer_credit', 'type' => 'checkbox',
|
||||
) );
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// === 5. ZUSÄTZLICHE FUNKTIONEN ==========================================
|
||||
// =========================================================================
|
||||
|
||||
// --- Sektion: FAQ Einstellungen ---
|
||||
$wp_customize->add_section( 'faq_settings', array( 'title' => 'FAQ Einstellungen', 'priority' => 60 ) );
|
||||
$wp_customize->add_setting( 'faq_enabled', array( 'default' => true, 'sanitize_callback' => 'wp_validate_boolean' ) );
|
||||
$wp_customize->add_control( 'faq_enabled', array(
|
||||
'label' => 'FAQ System aktivieren', 'section' => 'faq_settings', 'settings' => 'faq_enabled', 'type' => 'checkbox',
|
||||
) );
|
||||
|
||||
// =========================================================================
|
||||
// === 6. LOGIN-BEREICH ====================================================
|
||||
// =========================================================================
|
||||
|
||||
$wp_customize->add_section( 'login_settings', array(
|
||||
'title' => 'Login-Einstellungen',
|
||||
'priority' => 70,
|
||||
'description' => 'Passe das Aussehen der wp-admin Login-Seite an.',
|
||||
) );
|
||||
|
||||
// Login-Hintergrundbild
|
||||
$wp_customize->add_setting( 'login_background_image', array(
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
'transport' => 'refresh',
|
||||
) );
|
||||
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'login_background_image', array(
|
||||
'label' => 'Login-Hintergrundbild',
|
||||
'section' => 'login_settings',
|
||||
'settings' => 'login_background_image',
|
||||
) ) );
|
||||
|
||||
// Login-Logo
|
||||
$wp_customize->add_setting( 'login_logo', array(
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
'transport' => 'refresh',
|
||||
) );
|
||||
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'login_logo', array(
|
||||
'label' => 'Login-Logo (ersetzt das WordPress-Logo)',
|
||||
'section' => 'login_settings',
|
||||
'settings' => 'login_logo',
|
||||
) ) );
|
||||
|
||||
// Multi-Avatar UUIDs
|
||||
for ($i = 1; $i <= 5; $i++) {
|
||||
$wp_customize->add_setting( 'login_avatar_uuid_' . $i, array(
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'refresh',
|
||||
) );
|
||||
$wp_customize->add_control( 'login_avatar_uuid_' . $i, array(
|
||||
'label' => sprintf( 'Avatar %d UUID', $i ),
|
||||
'description' => sprintf( 'Gib die UUID für den %d. Avatar an. (Leer lassen, um zu deaktivieren)', $i ),
|
||||
'section' => 'login_settings',
|
||||
'settings' => 'login_avatar_uuid_' . $i,
|
||||
'type' => 'text',
|
||||
) );
|
||||
}
|
||||
|
||||
// Slider-Geschwindigkeit
|
||||
$wp_customize->add_setting( 'login_avatar_slider_speed', array(
|
||||
'default' => 4,
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'refresh',
|
||||
) );
|
||||
$wp_customize->add_control( 'login_avatar_slider_speed', array(
|
||||
'label' => 'Avatar-Wechsel (in Sekunden)',
|
||||
'description' => 'Wie viele Sekunden soll ein Avatar angezeigt werden?',
|
||||
'section' => 'login_settings',
|
||||
'settings' => 'login_avatar_slider_speed',
|
||||
'type' => 'number',
|
||||
'input_attrs' => array( 'min' => 2, 'max' => 10, 'step' => 1 ),
|
||||
) );
|
||||
}
|
||||
add_action( 'customize_register', 'minecraft_modern_customize_register' );
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// === DYNAMISCHES CSS =====================================================
|
||||
// =========================================================================
|
||||
|
||||
function minecraft_modern_dynamic_css_output() {
|
||||
$accent_color = get_theme_mod( 'primary_accent_color', '#00d4ff' );
|
||||
$slider_font = get_theme_mod( 'slider_font_family', 'Raleway' );
|
||||
$slider_color = get_theme_mod( 'slider_font_color', '#ffffff' );
|
||||
$slider_size_setting = get_theme_mod( 'slider_font_size', 'mittel' );
|
||||
$header_height_setting = get_theme_mod( 'header_height', 'mittel' ); // Diese Einstellung wird hier verwendet!
|
||||
|
||||
// Header-Höhe umwandeln
|
||||
$header_height_value = '300px';
|
||||
if ( $header_height_setting === 'klein' ) {
|
||||
$header_height_value = '200px';
|
||||
} elseif ( $header_height_setting === 'gross' ) {
|
||||
$header_height_value = '400px';
|
||||
}
|
||||
|
||||
// Schriftgrößen umwandeln
|
||||
$font_sizes = array(
|
||||
'klein' => array( 'title' => '2.5rem', 'subtitle' => '1.2rem' ),
|
||||
'mittel' => array( 'title' => '3.5rem', 'subtitle' => '1.4rem' ),
|
||||
'gross' => array( 'title' => '4.5rem', 'subtitle' => '1.6rem' ),
|
||||
'extra-gross' => array( 'title' => '5.5rem', 'subtitle' => '1.8rem' ),
|
||||
);
|
||||
$chosen_sizes = isset( $font_sizes[$slider_size_setting] ) ? $font_sizes[$slider_size_setting] : $font_sizes['mittel'];
|
||||
|
||||
$fonts_to_load = array($slider_font);
|
||||
$fonts_url = 'https://fonts.googleapis.com/css2?family=' . implode( ':wght@400;600;700&family=', $fonts_to_load ) . '&display=swap';
|
||||
?>
|
||||
|
||||
<link rel="stylesheet" href="<?php echo esc_url($fonts_url); ?>">
|
||||
<style type="text/css">
|
||||
:root {
|
||||
--primary-accent: <?php echo esc_attr($accent_color); ?>;
|
||||
--header-height: <?php echo esc_attr($header_height_value); ?>;
|
||||
}
|
||||
.slider-title, .slider-subtitle, .hero-title, .hero-subtitle, .hero-button-1, .hero-button-2 {
|
||||
font-family: '<?php echo esc_attr($slider_font); ?>', sans-serif;
|
||||
color: <?php echo esc_attr($slider_color); ?>;
|
||||
}
|
||||
.slider-title, .hero-title {
|
||||
font-size: <?php echo esc_attr($chosen_sizes['title']); ?>;
|
||||
}
|
||||
.slider-subtitle, .hero-subtitle {
|
||||
font-size: <?php echo esc_attr($chosen_sizes['subtitle']); ?>;
|
||||
}
|
||||
|
||||
/* =================================================================== */
|
||||
/* === NEU: Trennlinien mit der Akzentfarbe ========================= */
|
||||
/* =================================================================== */
|
||||
|
||||
/* Trennlinie unter dem Header */
|
||||
.site-header {
|
||||
border-bottom: 4px solid var(--primary-accent);
|
||||
}
|
||||
|
||||
/* Trennlinie unter dem Slider */
|
||||
.hero-slider {
|
||||
border-bottom: 4px solid var(--primary-accent);
|
||||
}
|
||||
|
||||
/* Trennlinie am oberen Rand des Footers */
|
||||
.site-footer {
|
||||
border-top: 4px solid var(--primary-accent);
|
||||
}
|
||||
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
add_action( 'wp_head', 'minecraft_modern_dynamic_css_output' );
|
||||
19
Minecraft-Modern-Theme/js/login-script.js
Normal file
19
Minecraft-Modern-Theme/js/login-script.js
Normal file
@@ -0,0 +1,19 @@
|
||||
jQuery(document).ready(function($) {
|
||||
// Warte, bis das DOM vollständig geladen ist
|
||||
// Wir erstellen einen Wrapper um den Avatar-Slider und das Formular, um das Flexbox-Layout zu ermöglichen.
|
||||
const avatar = $('#minecraft-avatar-slider');
|
||||
const form = $('#loginform');
|
||||
|
||||
// Nur ausführen, wenn beide Elemente existieren
|
||||
if (avatar.length && form.length) {
|
||||
// Erstelle einen neuen Wrapper-Div
|
||||
const wrapper = $('<div id="login-content-wrapper"></div>');
|
||||
|
||||
// Füge den Wrapper vor dem Formular in den #login Container ein
|
||||
form.before(wrapper);
|
||||
|
||||
// Verschiebe den Avatar-Slider und das Formular in den Wrapper
|
||||
wrapper.append(avatar);
|
||||
wrapper.append(form);
|
||||
}
|
||||
});
|
||||
25
Minecraft-Modern-Theme/js/login-slider.js
Normal file
25
Minecraft-Modern-Theme/js/login-slider.js
Normal file
@@ -0,0 +1,25 @@
|
||||
jQuery(document).ready(function($) {
|
||||
const slider = $('#minecraft-avatar-slider');
|
||||
const slides = slider.find('.avatar-slide');
|
||||
|
||||
// Nur starten, wenn es mehr als einen Slide gibt
|
||||
if (slides.length > 1) {
|
||||
let currentIndex = 0;
|
||||
|
||||
function showSlide(index) {
|
||||
slides.removeClass('avatar-slide-active');
|
||||
slides.eq(index).addClass('avatar-slide-active');
|
||||
}
|
||||
|
||||
function nextSlide() {
|
||||
currentIndex = (currentIndex + 1) % slides.length;
|
||||
showSlide(currentIndex);
|
||||
}
|
||||
|
||||
// Geschwindigkeit aus den WordPress-Einstellungen holen
|
||||
const speed = avatarSliderSettings.speed || 4000;
|
||||
|
||||
// Den Slider alle X Sekunden wechseln
|
||||
setInterval(nextSlide, speed);
|
||||
}
|
||||
});
|
||||
30
Minecraft-Modern-Theme/js/scroll-to-top.js
Normal file
30
Minecraft-Modern-Theme/js/scroll-to-top.js
Normal file
@@ -0,0 +1,30 @@
|
||||
jQuery(document).ready(function($) {
|
||||
// Wähle den Button aus
|
||||
var scrollButton = $('#scroll-to-top');
|
||||
|
||||
// Funktion zum Anzeigen oder Verstecken des Buttons
|
||||
function toggleScrollButton() {
|
||||
// Wenn mehr als 300px gescrollt wurde, zeige den Button
|
||||
if ($(window).scrollTop() > 300) {
|
||||
scrollButton.addClass('show');
|
||||
} else {
|
||||
scrollButton.removeClass('show');
|
||||
}
|
||||
}
|
||||
|
||||
// Event Listener für das Scrollen
|
||||
$(window).on('scroll', function() {
|
||||
toggleScrollButton();
|
||||
});
|
||||
|
||||
// Event Listener für den Klick auf den Button
|
||||
scrollButton.on('click', function(e) {
|
||||
// Verhindere das Standardverhalten des Links
|
||||
e.preventDefault();
|
||||
|
||||
// Scrolle die Seite sanft nach oben
|
||||
$('html, body').animate({
|
||||
scrollTop: 0
|
||||
}, 800); // 800ms für eine sanfte Animation
|
||||
});
|
||||
});
|
||||
@@ -1,55 +1,52 @@
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Hole den Slider-Container
|
||||
const heroSlider = document.querySelector('.hero-slider');
|
||||
|
||||
// Stelle sicher, dass der Slider auf der Seite existiert, bevor du versuchst, ihn zu konfigurieren
|
||||
if (!heroSlider) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Konfiguration für den Slider vorbereiten
|
||||
const swiperConfig = {
|
||||
// Optionen für den Slider
|
||||
loop: true, // Endloses Schleifen
|
||||
|
||||
// Autoplay
|
||||
autoplay: {
|
||||
delay: 5000, // 5 Sekunden pro Slide
|
||||
disableOnInteraction: false, // Autoplay nicht nach Klick stoppen
|
||||
},
|
||||
|
||||
// Wenn der Nutzer die Maus darüber bewegt, pausieren
|
||||
pauseOnMouseEnter: true,
|
||||
|
||||
// Effekt
|
||||
effect: 'fade', // Übergangseffekt: 'slide', 'fade', 'cube', etc.
|
||||
fadeEffect: {
|
||||
crossFade: true
|
||||
}
|
||||
};
|
||||
|
||||
// Prüfe, ob die Pfeile ausgeblendet werden sollen
|
||||
if (sliderSettings.hideArrows === '1') {
|
||||
heroSlider.classList.add('slider-hide-arrows');
|
||||
} else {
|
||||
// Navigation nur hinzufügen, wenn sie nicht ausgeblendet wird
|
||||
swiperConfig.navigation = {
|
||||
nextEl: '.swiper-button-next',
|
||||
prevEl: '.swiper-button-prev',
|
||||
};
|
||||
}
|
||||
|
||||
// Prüfe, ob die Paginierung ausgeblendet werden soll
|
||||
if (sliderSettings.hidePagination === '1') {
|
||||
heroSlider.classList.add('slider-hide-pagination');
|
||||
} else {
|
||||
// Pagination nur hinzufügen, wenn sie nicht ausgeblendet wird
|
||||
swiperConfig.pagination = {
|
||||
el: '.swiper-pagination',
|
||||
clickable: true, // Klick auf Punkt springt zum Slide
|
||||
};
|
||||
}
|
||||
|
||||
// Initialisiere den Slider mit der konfigurierten Optionen
|
||||
new Swiper('.hero-slider', swiperConfig);
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Hole den Slider-Container
|
||||
const heroSlider = document.querySelector('.hero-slider');
|
||||
|
||||
// Stelle sicher, dass der Slider auf der Seite existiert
|
||||
if (!heroSlider) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Konfiguration für den Slider vorbereiten
|
||||
const swiperConfig = {
|
||||
// Der Effekt ist jetzt fest auf "Überblenden" eingestellt
|
||||
effect: 'fade',
|
||||
fadeEffect: {
|
||||
crossFade: true
|
||||
},
|
||||
|
||||
// Loop-Einstellung ist jetzt DYNAMISCH
|
||||
loop: sliderSettings.loop === '1',
|
||||
|
||||
// Autoplay
|
||||
autoplay: {
|
||||
delay: 5000,
|
||||
disableOnInteraction: false,
|
||||
},
|
||||
|
||||
pauseOnMouseEnter: true,
|
||||
|
||||
// Prüfe, ob die Pfeile NICHT ausgeblendet werden sollen
|
||||
navigation: sliderSettings.hideArrows !== '1' ? {
|
||||
nextEl: '.swiper-button-next',
|
||||
prevEl: '.swiper-button-prev',
|
||||
} : false,
|
||||
|
||||
// Prüfe, ob die Paginierung NICHT ausgeblendet werden soll
|
||||
pagination: sliderSettings.hidePagination !== '1' ? {
|
||||
el: '.swiper-pagination',
|
||||
clickable: true,
|
||||
} : false,
|
||||
|
||||
on: {
|
||||
init: function () {
|
||||
setTimeout(() => {
|
||||
heroSlider.classList.add('swiper-initialized');
|
||||
}, 50);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// Initialisiere den Slider mit der konfigurierten Optionen
|
||||
new Swiper('.hero-slider', swiperConfig);
|
||||
});
|
||||
84
Minecraft-Modern-Theme/page-login.php
Normal file
84
Minecraft-Modern-Theme/page-login.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/*
|
||||
Template Name: Benutzerdefinierte Authentifizierungsseite
|
||||
*/
|
||||
|
||||
get_header(); ?>
|
||||
|
||||
<div class="container">
|
||||
<div id="primary" class="content-area">
|
||||
<main id="main" class="site-main">
|
||||
<div class="custom-auth-container">
|
||||
<?php if (is_user_logged_in()) : ?>
|
||||
<!-- Wenn der Benutzer angemeldet ist, zeige eine Nachricht und einen Logout-Link -->
|
||||
<div class="logged-in-message">
|
||||
<h2>Willkommen zurück, <?php echo esc_html(wp_get_current_user()->display_name); ?>!</h2>
|
||||
<p>Du bist bereits angemeldet.</p>
|
||||
<p>
|
||||
<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>
|
||||
</p>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<!-- Wenn der Benutzer nicht angemeldet ist, zeige das Registrierungsformular -->
|
||||
<h1 class="auth-title">Willkommen auf <?php bloginfo('name'); ?></h1>
|
||||
<p class="auth-subtitle">Erstelle deinen Account und werde Teil unserer Community!</p>
|
||||
|
||||
<?php
|
||||
// Zeige das Registrierungsformular an
|
||||
$args = array(
|
||||
'echo' => true,
|
||||
'redirect' => home_url('/login/?checkemail=registered'), // Weiterleitung nach der Registrierung
|
||||
'form_id' => 'custom_registerform',
|
||||
'label_username' => __( 'Benutzername' ),
|
||||
'label_email' => __( 'E-Mail-Adresse' ),
|
||||
'label_password' => __( 'Passwort' ),
|
||||
'label_remember' => __( 'Angemeldet bleiben' ),
|
||||
'label_log_in' => __( 'Registrieren' ),
|
||||
'id_username' => 'user_login',
|
||||
'id_email' => 'user_email',
|
||||
'id_password' => 'user_pass',
|
||||
'id_remember' => 'rememberme',
|
||||
'id_submit' => 'wp-submit',
|
||||
'remember' => true,
|
||||
'value_username' => NULL,
|
||||
'value_remember' => false
|
||||
);
|
||||
wp_register_form($args);
|
||||
?>
|
||||
|
||||
<div class="login-form-link">
|
||||
<p>Schon hast du einen Account? <a href="<?php echo esc_url(wp_login_url()); ?>">Hier anmelden</a>.</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// Hintergrundbild aus dem Customizer holen und als Inline-CSS ausgeben
|
||||
$auth_bg_image = get_theme_mod('login_background_image');
|
||||
if ($auth_bg_image):
|
||||
?>
|
||||
<style>
|
||||
body.login, body.login-action-register {
|
||||
background-image: url('<?php echo esc_url($auth_bg_image); ?>') !important;
|
||||
background-size: cover !important;
|
||||
background-position: center !important;
|
||||
background-repeat: no-repeat !important;
|
||||
}
|
||||
body.login::before, body.login-action-register::before {
|
||||
content: '';
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(20, 21, 26, 0.8);
|
||||
z-index: -1;
|
||||
}
|
||||
</style>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
BIN
Minecraft-Modern-Theme/screenshot.PNG
Normal file
BIN
Minecraft-Modern-Theme/screenshot.PNG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
File diff suppressed because it is too large
Load Diff
100
README.md
100
README.md
@@ -1,2 +1,100 @@
|
||||
# Minecraft-Modern-Theme
|
||||
# Minecraft Modern Theme
|
||||
|
||||
Ein modernes und flexibles WordPress-Theme, perfekt für Minecraft-Server, Gaming-Communities und Gamer-Blogs. Passe deine Seite mit wenigen Klicks ganz nach deinem Stil an!
|
||||
|
||||
|
||||
<div align="center">
|
||||
<img src="https://git.viper.ipv64.net/M_Viper/Minecraft-Modern-Theme/raw/branch/main/Minecraft-Modern-Theme/screenshot.PNG" alt="Theme Screenshot" style="max-width: 500px; width: 100%; height: auto; border-radius: 8px;">
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Hauptfunktionen
|
||||
|
||||
- **🎨 Dynamischer Header-Slider:** Zeige bis zu 5 beeindruckende Banner mit individuellem Text, Effekten und Animationen.
|
||||
- **🌙 Dark & Light Mode:** Lass deine Besucher zwischen einem dunklen und einem hellen Design wählen.
|
||||
- **🎨 Komplette Farbanpassung:** Wähle deine eigene Akzentfarbe und Hintergrundfarbe, um dein Branding perfekt abzubilden.
|
||||
- **🌐 Social Media Integration:** Verlinke einfach all deine Kanäle (Discord, YouTube, Twitter, TikTok und viele mehr).
|
||||
- **📄 Eigenes FAQ-System:** Erstelle und verwalte eine eigene FAQ-Seite direkt im WordPress-Menü, ohne zusätzliche Plugins.
|
||||
- **🔐 Angepasste Login-Seite:** Gestalte die Login-Seite mit deinem eigenen Logo, Hintergrund und einem coolen Minecraft-Avatar-Slider.
|
||||
- **⬆️ "Nach oben"-Button:** Ein praktischer Button, der deinen Besuchern das Scrollen erleichtert.
|
||||
|
||||
---
|
||||
|
||||
## 📦 Installation (in 3 einfachen Schritten)
|
||||
|
||||
1. **Lade das Theme herunter:** Lade die `minecraft-modern.zip`-Datei herunter.
|
||||
2. **Lade es in WordPress hoch:**
|
||||
* Gehe in deinem WordPress-Adminbereich zu **Design > Themes > Installieren**.
|
||||
* Klicke auf den Button **Theme hochladen**.
|
||||
* Wähle die heruntergeladene `minecraft-modern.zip`-Datei aus und installiere sie.
|
||||
3. **Aktiviere das Theme:** Klicke nach der Installation auf **Aktivieren**. Fertig!
|
||||
|
||||
---
|
||||
|
||||
## 👶 Wichtig: Nutze das Child Theme!
|
||||
|
||||
Wenn du planst, Anpassungen vorzunehmen (z.B. Farben per Code ändern oder PHP-Dateien bearbeiten), solltest du unbedingt das mitgelieferte **Child Theme** verwenden.
|
||||
|
||||
**Warum?** Damit deine persönlichen Anpassungen bei einem Theme-Update nicht überschrieben werden!
|
||||
|
||||
### Installation des Child Themes (Der einfache Weg)
|
||||
|
||||
1. **Lade das Child Theme herunter:** Lade die `minecraft-modern-child.zip`-Datei herunter.
|
||||
2. **Lade es in WordPress hoch:**
|
||||
* Gehe zu **Design > Themes > Installieren**.
|
||||
* Klicke auf **Theme hochladen**.
|
||||
* Wähle die `minecraft-modern-child.zip`-Datei aus und installiere sie.
|
||||
3. **Aktiviere das Child Theme:** Klicke auf **Aktivieren**.
|
||||
|
||||
**Wichtig:** Das Haupt-Theme (Minecraft Modern) muss weiterhin installiert bleiben, darf aber nicht aktiviert sein. WordPress erkennt dies automatisch.
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ So passt du dein Theme an
|
||||
|
||||
Gehe in deinem WordPress-Dashboard zu **Design > Anpassen**, um in die Einstellungen zu gelangen.
|
||||
|
||||
### 1. Header-Slider einrichten
|
||||
|
||||
Unter dem Punkt **Header Slider** kannst du:
|
||||
- Den Slider mit einem Haken aktivieren.
|
||||
- Bis zu 5 **Bilder, Titel und Untertitel** hochladen.
|
||||
- Die **Schriftart, -größe und -farbe** anpassen.
|
||||
- Einen **Effekt** auswählen (z.B. Überblenden oder Würfel).
|
||||
- Die **Pfeile** oder **Punkte** zur Navigation ausblenden.
|
||||
|
||||
### 2. Farben & Design auswählen
|
||||
|
||||
Unter **Farben & Darstellung** findest du:
|
||||
- **Akzentfarbe:** Die Hauptfarbe deines Themes (wird für Buttons, Links etc. verwendet).
|
||||
- **Hintergrundfarbe:** Die Farbe des Seitenhintergrunds.
|
||||
- **Standard-Theme-Modus:** Entscheide, ob deine Seite standardmäßig im Dark- oder Light-Mode starten soll.
|
||||
|
||||
### 3. Social-Media-Links hinzufügen
|
||||
|
||||
Im Menüpunkt **Social Media Links** kannst du bei den jeweiligen Plattformen einfach deine URL eintragen. Die Icons erscheinen dann automatisch an der vorgesehenen Stelle.
|
||||
|
||||
### 4. Footer anpassen
|
||||
|
||||
Unter **Footer-Einstellungen** kannst du:
|
||||
- Den **Copyright-Text** ändern.
|
||||
- Die URLs für dein **Impressum** und die **Datenschutz**-Seite einfügen.
|
||||
- Den "Erstellt von"-Verweis am Ende der Seite ausblenden.
|
||||
|
||||
### 5. FAQs erstellen
|
||||
|
||||
1. Gehe zu **FAQ Einstellungen** und setze einen Haken bei "FAQ System aktivieren".
|
||||
2. Das Theme erstellt automatisch eine neue Seite namens "FAQ" und einen neuen Menüpunkt **FAQs** in deinem WordPress-Dashboard.
|
||||
3. Unter **FAQs > Neue FAQ hinzufügen** kannst du jetzt deine Fragen und Antworten erstellen. Du kannst sie sogar in Kategorien sortieren!
|
||||
|
||||
### 6. Login-Seite gestalten
|
||||
|
||||
Unter **Login-Einstellungen** kannst du:
|
||||
- Ein **Hintergrundbild** und ein **Logo** für die Login-Seite hochladen.
|
||||
- Bis zu 5 **Minecraft-Avatar-UUIDs** eintragen, um einen dynamischen Avatar-Slider zu erzeugen. (Eine UUID findest du z.B. auf [minotar.net](https://minotar.net/)).
|
||||
- Die **Geschwindigkeit** des Avatar-Wechsels einstellen.
|
||||
|
||||
---
|
||||
|
||||
Viel Spaß mit deinem neuen Theme! 🎮✨
|
||||
Reference in New Issue
Block a user