Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ae10138d51 | |||
| 991d9c38c8 | |||
| 4ad76fabf6 | |||
| d46684dc7e | |||
| dc14b838d6 | |||
| f397108cf0 | |||
| 6896f6aa26 | |||
| e119411758 | |||
| 50c636a17f | |||
| 9051f74598 | |||
| 777a999fed | |||
| d27c2b1259 | |||
| cc36e57079 | |||
| ca6955d579 | |||
| ddbf78a5c0 | |||
| b3638449ea | |||
| 863deb2592 | |||
| c7e8703787 | |||
| 39f1d87475 |
@@ -1,47 +1,47 @@
|
||||
<?php get_header(); ?>
|
||||
|
||||
<div class="container site-main">
|
||||
<div class="content-area">
|
||||
<div class="team-archive-container">
|
||||
<header class="page-header">
|
||||
<h1 class="page-title">Unser Team</h1>
|
||||
<p class="page-description">Lerne die Leute kennen, die diesen Server am Laufen halten.</p>
|
||||
</header>
|
||||
|
||||
<?php
|
||||
$query = new WP_Query(array('post_type' => 'team_member', 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC'));
|
||||
if ( $query->have_posts() ) : ?>
|
||||
<div class="team-grid">
|
||||
<?php while ( $query->have_posts() ) : $query->the_post();
|
||||
$rank_string = get_post_meta( get_the_ID(), '_team_member_rank', true );
|
||||
$img = get_the_post_thumbnail_url( get_the_ID(), 'medium' );
|
||||
if ( !$img ) $img = get_template_directory_uri() . '/images/default-avatar.png';
|
||||
?>
|
||||
<article class="team-card">
|
||||
<div class="team-image-wrapper">
|
||||
<img src="<?php echo esc_url($img); ?>" alt="<?php echo esc_attr(get_the_title()); ?>">
|
||||
</div>
|
||||
<div class="team-info">
|
||||
<h3 class="team-name"><?php the_title(); ?></h3>
|
||||
<div class="team-ranks-wrapper">
|
||||
<?php if ( !empty($rank_string) ) {
|
||||
$ranks = explode(',', $rank_string);
|
||||
foreach ( $ranks as $r ) {
|
||||
echo '<span class="team-rank">' . esc_html(trim($r)) . '</span>';
|
||||
}
|
||||
} ?>
|
||||
</div>
|
||||
<div class="team-bio"><?php the_excerpt(); ?></div>
|
||||
</div>
|
||||
</article>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
<?php wp_reset_postdata(); ?>
|
||||
<?php else : ?>
|
||||
<p>Noch keine Teammitglieder.</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php get_header(); ?>
|
||||
|
||||
<div class="container site-main">
|
||||
<div class="content-area">
|
||||
<div class="team-archive-container">
|
||||
<header class="page-header">
|
||||
<h1 class="page-title">Unser Team</h1>
|
||||
<p class="page-description">Lerne die Leute kennen, die diesen Server am Laufen halten.</p>
|
||||
</header>
|
||||
|
||||
<?php
|
||||
$query = new WP_Query(array('post_type' => 'team_member', 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC'));
|
||||
if ( $query->have_posts() ) : ?>
|
||||
<div class="team-grid">
|
||||
<?php while ( $query->have_posts() ) : $query->the_post();
|
||||
$rank_string = get_post_meta( get_the_ID(), '_team_member_rank', true );
|
||||
$img = get_the_post_thumbnail_url( get_the_ID(), 'medium' );
|
||||
if ( !$img ) $img = get_template_directory_uri() . '/images/default-avatar.png';
|
||||
?>
|
||||
<article class="team-card">
|
||||
<div class="team-image-wrapper">
|
||||
<img src="<?php echo esc_url($img); ?>" alt="<?php echo esc_attr(get_the_title()); ?>">
|
||||
</div>
|
||||
<div class="team-info">
|
||||
<h3 class="team-name"><?php the_title(); ?></h3>
|
||||
<div class="team-ranks-wrapper">
|
||||
<?php if ( !empty($rank_string) ) {
|
||||
$ranks = explode(',', $rank_string);
|
||||
foreach ( $ranks as $r ) {
|
||||
echo '<span class="team-rank">' . esc_html(trim($r)) . '</span>';
|
||||
}
|
||||
} ?>
|
||||
</div>
|
||||
<div class="team-bio"><?php the_excerpt(); ?></div>
|
||||
</div>
|
||||
</article>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
<?php wp_reset_postdata(); ?>
|
||||
<?php else : ?>
|
||||
<p>Noch keine Teammitglieder.</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
@@ -1,135 +1,416 @@
|
||||
<?php get_header(); ?>
|
||||
|
||||
<?php
|
||||
// =====================================================
|
||||
// HERO SLIDER ODER HERO SECTION
|
||||
// =====================================================
|
||||
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>
|
||||
|
||||
<?php if ( ! get_theme_mod( 'slider_hide_pagination', false ) ) : ?>
|
||||
<div class="swiper-pagination"></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! get_theme_mod( 'slider_hide_arrows', false ) ) : ?>
|
||||
<div class="swiper-button-prev"></div>
|
||||
<div class="swiper-button-next"></div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
|
||||
<!-- ================================================= -->
|
||||
<!-- ANNOUNCEMENT ANKER (unter Slider, ohne Scroll-Bug) -->
|
||||
<!-- ================================================= -->
|
||||
<div id="mm-announcement-anchor"></div>
|
||||
|
||||
<?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>
|
||||
|
||||
<!-- ================================================= -->
|
||||
<!-- ANNOUNCEMENT ANKER (unter Hero, ohne Scroll-Bug) -->
|
||||
<!-- ================================================= -->
|
||||
<div id="mm-announcement-anchor"></div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- ===================================================== -->
|
||||
<!-- MAIN CONTENT -->
|
||||
<!-- ===================================================== -->
|
||||
<main id="primary" class="site-main">
|
||||
<div class="container">
|
||||
<div class="content-area">
|
||||
|
||||
<?php if ( have_posts() ) : ?>
|
||||
<?php while ( have_posts() ) : the_post(); ?>
|
||||
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class( 'post' ); ?>>
|
||||
|
||||
<?php if ( has_post_thumbnail() ) : ?>
|
||||
<div class="post-thumbnail">
|
||||
<a href="<?php the_permalink(); ?>">
|
||||
<?php the_post_thumbnail( 'medium_large' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="post-content">
|
||||
<h2 class="post-title">
|
||||
<a href="<?php the_permalink(); ?>">
|
||||
<?php the_title(); ?>
|
||||
</a>
|
||||
</h2>
|
||||
|
||||
<div class="post-full-content">
|
||||
<?php the_content(); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</article>
|
||||
|
||||
<?php endwhile; ?>
|
||||
<?php else : ?>
|
||||
|
||||
<p><?php esc_html_e( 'Keine Beiträge gefunden.', 'minecraft-modern-theme' ); ?></p>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
<?php get_header(); ?>
|
||||
|
||||
<?php
|
||||
// =====================================================
|
||||
// HERO SLIDER ODER HERO SECTION
|
||||
// =====================================================
|
||||
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>
|
||||
|
||||
<?php if ( ! get_theme_mod( 'slider_hide_pagination', false ) ) : ?>
|
||||
<div class="swiper-pagination"></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! get_theme_mod( 'slider_hide_arrows', false ) ) : ?>
|
||||
<div class="swiper-button-prev"></div>
|
||||
<div class="swiper-button-next"></div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
|
||||
<!-- ================================================= -->
|
||||
<!-- ANNOUNCEMENT ANKER (unter Slider, ohne Scroll-Bug) -->
|
||||
<!-- ================================================= -->
|
||||
<div id="mm-announcement-anchor"></div>
|
||||
|
||||
<?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>
|
||||
|
||||
<!-- ================================================= -->
|
||||
<!-- ANNOUNCEMENT ANKER (unter Hero, ohne Scroll-Bug) -->
|
||||
<!-- ================================================= -->
|
||||
<div id="mm-announcement-anchor"></div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- ===================================================== -->
|
||||
<!-- MAIN CONTENT MIT SIDEBAR -->
|
||||
<!-- ===================================================== -->
|
||||
<main id="primary" class="site-main">
|
||||
<div class="container">
|
||||
|
||||
<?php
|
||||
// Hole Sidebar-Einstellungen
|
||||
$sidebar_enabled = get_theme_mod( 'homepage_sidebar_enabled', false );
|
||||
$sidebar_position = get_theme_mod( 'homepage_sidebar_position', 'right' );
|
||||
|
||||
// Prüfe ob mindestens ein Sidebar-Bereich aktiv ist
|
||||
$has_sidebar_content = (
|
||||
is_active_sidebar( 'homepage-sidebar-top' ) ||
|
||||
is_active_sidebar( 'homepage-sidebar-middle-1' ) ||
|
||||
is_active_sidebar( 'homepage-sidebar-middle-2' ) ||
|
||||
is_active_sidebar( 'homepage-sidebar-bottom' ) ||
|
||||
is_active_sidebar( 'homepage-sidebar-extra' )
|
||||
);
|
||||
|
||||
// Setze CSS-Klassen basierend auf Sidebar-Status
|
||||
$content_class = 'content-area';
|
||||
if ( $sidebar_enabled && $has_sidebar_content ) {
|
||||
$content_class = 'content-area with-sidebar sidebar-' . esc_attr( $sidebar_position );
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="<?php echo esc_attr( $content_class ); ?>">
|
||||
|
||||
<?php if ( $sidebar_enabled && $sidebar_position === 'left' && $has_sidebar_content ) : ?>
|
||||
<!-- SIDEBAR LINKS -->
|
||||
<aside class="homepage-sidebar sidebar-left">
|
||||
<?php if ( is_active_sidebar( 'homepage-sidebar-top' ) ) : ?>
|
||||
<div class="sidebar-section sidebar-top">
|
||||
<?php dynamic_sidebar( 'homepage-sidebar-top' ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( is_active_sidebar( 'homepage-sidebar-middle-1' ) ) : ?>
|
||||
<div class="sidebar-section sidebar-middle-1">
|
||||
<?php dynamic_sidebar( 'homepage-sidebar-middle-1' ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( is_active_sidebar( 'homepage-sidebar-middle-2' ) ) : ?>
|
||||
<div class="sidebar-section sidebar-middle-2">
|
||||
<?php dynamic_sidebar( 'homepage-sidebar-middle-2' ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( is_active_sidebar( 'homepage-sidebar-bottom' ) ) : ?>
|
||||
<div class="sidebar-section sidebar-bottom">
|
||||
<?php dynamic_sidebar( 'homepage-sidebar-bottom' ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( is_active_sidebar( 'homepage-sidebar-extra' ) ) : ?>
|
||||
<div class="sidebar-section sidebar-extra">
|
||||
<?php dynamic_sidebar( 'homepage-sidebar-extra' ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</aside>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- HAUPTINHALT -->
|
||||
<div class="main-content">
|
||||
<?php if ( have_posts() ) : ?>
|
||||
<?php while ( have_posts() ) : the_post(); ?>
|
||||
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class( 'post' ); ?>>
|
||||
|
||||
<?php if ( has_post_thumbnail() ) : ?>
|
||||
<div class="post-thumbnail">
|
||||
<a href="<?php the_permalink(); ?>">
|
||||
<?php the_post_thumbnail( 'medium_large' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="post-content">
|
||||
<h2 class="post-title">
|
||||
<a href="<?php the_permalink(); ?>">
|
||||
<?php the_title(); ?>
|
||||
</a>
|
||||
</h2>
|
||||
|
||||
<div class="post-full-content">
|
||||
<?php the_content(); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</article>
|
||||
|
||||
<?php endwhile; ?>
|
||||
<?php else : ?>
|
||||
|
||||
<p><?php esc_html_e( 'Keine Beiträge gefunden.', 'minecraft-modern-theme' ); ?></p>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if ( $sidebar_enabled && $sidebar_position === 'right' && $has_sidebar_content ) : ?>
|
||||
<!-- SIDEBAR RECHTS -->
|
||||
<aside class="homepage-sidebar sidebar-right">
|
||||
<?php if ( is_active_sidebar( 'homepage-sidebar-top' ) ) : ?>
|
||||
<div class="sidebar-section sidebar-top">
|
||||
<?php dynamic_sidebar( 'homepage-sidebar-top' ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( is_active_sidebar( 'homepage-sidebar-middle-1' ) ) : ?>
|
||||
<div class="sidebar-section sidebar-middle-1">
|
||||
<?php dynamic_sidebar( 'homepage-sidebar-middle-1' ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( is_active_sidebar( 'homepage-sidebar-middle-2' ) ) : ?>
|
||||
<div class="sidebar-section sidebar-middle-2">
|
||||
<?php dynamic_sidebar( 'homepage-sidebar-middle-2' ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( is_active_sidebar( 'homepage-sidebar-bottom' ) ) : ?>
|
||||
<div class="sidebar-section sidebar-bottom">
|
||||
<?php dynamic_sidebar( 'homepage-sidebar-bottom' ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( is_active_sidebar( 'homepage-sidebar-extra' ) ) : ?>
|
||||
<div class="sidebar-section sidebar-extra">
|
||||
<?php dynamic_sidebar( 'homepage-sidebar-extra' ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</aside>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- ===================================================== -->
|
||||
<!-- ZUSÄTZLICHES CSS FÜR SIDEBAR LAYOUT -->
|
||||
<!-- ===================================================== -->
|
||||
<style>
|
||||
/* Content ohne Sidebar - volle Breite */
|
||||
.content-area .main-content {
|
||||
width: 100%;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
/* Container mit Sidebar-Layout */
|
||||
.content-area.with-sidebar {
|
||||
display: grid;
|
||||
gap: 30px;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
/* Sidebar rechts (Standard) */
|
||||
.content-area.with-sidebar.sidebar-right {
|
||||
grid-template-columns: 1fr 300px;
|
||||
}
|
||||
|
||||
.content-area.with-sidebar.sidebar-right .main-content {
|
||||
order: 1;
|
||||
}
|
||||
|
||||
.content-area.with-sidebar.sidebar-right .homepage-sidebar {
|
||||
order: 2;
|
||||
}
|
||||
|
||||
/* Sidebar links */
|
||||
.content-area.with-sidebar.sidebar-left {
|
||||
grid-template-columns: 300px 1fr;
|
||||
}
|
||||
|
||||
.content-area.with-sidebar.sidebar-left .homepage-sidebar {
|
||||
order: 1;
|
||||
}
|
||||
|
||||
.content-area.with-sidebar.sidebar-left .main-content {
|
||||
order: 2;
|
||||
}
|
||||
|
||||
/* Entfernt das Sticky-Verhalten der Sidebar komplett */
|
||||
.homepage-sidebar {
|
||||
position: relative !important;
|
||||
top: auto !important;
|
||||
background: var(--card-background, #1e2029);
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
overflow-y: auto;
|
||||
max-height: calc(200vh - 10vh);
|
||||
}
|
||||
|
||||
/* Sidebar Sections - Bereiche innerhalb der Sidebar */
|
||||
.homepage-sidebar .sidebar-section {
|
||||
margin-bottom: 30px;
|
||||
padding-bottom: 20px;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.homepage-sidebar .sidebar-section:last-child {
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 0;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
/* Spezielle Styling für bestimmte Bereiche */
|
||||
.homepage-sidebar .sidebar-top {
|
||||
border-bottom: 2px solid var(--primary-accent, #00d4ff);
|
||||
}
|
||||
|
||||
.homepage-sidebar .sidebar-bottom {
|
||||
padding-top: 20px;
|
||||
border-top: 2px solid var(--primary-accent, #00d4ff);
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.homepage-sidebar .widget {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.homepage-sidebar .widget:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.homepage-sidebar .widget-title {
|
||||
font-size: 1.2rem;
|
||||
margin-bottom: 15px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 2px solid var(--primary-accent, #00d4ff);
|
||||
color: var(--primary-accent, #00d4ff);
|
||||
}
|
||||
|
||||
.homepage-sidebar ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.homepage-sidebar ul li {
|
||||
padding: 8px 0;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.homepage-sidebar ul li:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.homepage-sidebar a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
|
||||
.homepage-sidebar a:hover {
|
||||
color: var(--primary-accent, #00d4ff);
|
||||
}
|
||||
|
||||
/* Mobile: Sidebar unter Content */
|
||||
@media (max-width: 768px) {
|
||||
.content-area.with-sidebar.sidebar-right,
|
||||
.content-area.with-sidebar.sidebar-left {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.content-area.with-sidebar .homepage-sidebar {
|
||||
order: 3 !important; /* Immer unten auf mobilen Geräten */
|
||||
position: relative;
|
||||
top: 0;
|
||||
max-height: none;
|
||||
}
|
||||
|
||||
.content-area.with-sidebar .main-content {
|
||||
order: 1 !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Dark Mode Anpassungen */
|
||||
body.dark-mode .homepage-sidebar {
|
||||
background: #1e1e1e;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
body.dark-mode .homepage-sidebar ul li {
|
||||
border-bottom-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
/* Light Mode Anpassungen */
|
||||
body.light-mode .homepage-sidebar {
|
||||
background: #ffffff;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
body.light-mode .homepage-sidebar .sidebar-section {
|
||||
border-bottom-color: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
body.light-mode .homepage-sidebar ul li {
|
||||
border-bottom-color: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
body.light-mode .homepage-sidebar .widget-title {
|
||||
color: var(--primary-accent, #00d4ff);
|
||||
}
|
||||
|
||||
/* Scrollbar Styling für Sidebar */
|
||||
.homepage-sidebar::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
.homepage-sidebar::-webkit-scrollbar-track {
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.homepage-sidebar::-webkit-scrollbar-thumb {
|
||||
background: var(--primary-accent, #00d4ff);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.homepage-sidebar::-webkit-scrollbar-thumb:hover {
|
||||
background: var(--primary-accent-hover, #00b8e6);
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
@@ -168,6 +168,65 @@ function minecraft_modern_footer_widgets() {
|
||||
}
|
||||
add_action( 'widgets_init', 'minecraft_modern_footer_widgets' );
|
||||
|
||||
// === Homepage Sidebar registrieren ===
|
||||
function minecraft_modern_homepage_sidebar() {
|
||||
// Hauptbereich oben
|
||||
register_sidebar( array(
|
||||
'name' => __( 'Startseiten Sidebar - Oben', 'minecraft-modern-theme' ),
|
||||
'id' => 'homepage-sidebar-top',
|
||||
'description' => __( 'Widget-Bereich oben in der Sidebar (z.B. für wichtige Infos).', 'minecraft-modern-theme' ),
|
||||
'before_widget' => '<div id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h3 class="widget-title">',
|
||||
'after_title' => '</h3>',
|
||||
) );
|
||||
|
||||
// Mittlerer Bereich 1
|
||||
register_sidebar( array(
|
||||
'name' => __( 'Startseiten Sidebar - Mitte 1', 'minecraft-modern-theme' ),
|
||||
'id' => 'homepage-sidebar-middle-1',
|
||||
'description' => __( 'Widget-Bereich in der Mitte der Sidebar.', 'minecraft-modern-theme' ),
|
||||
'before_widget' => '<div id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h3 class="widget-title">',
|
||||
'after_title' => '</h3>',
|
||||
) );
|
||||
|
||||
// Mittlerer Bereich 2
|
||||
register_sidebar( array(
|
||||
'name' => __( 'Startseiten Sidebar - Mitte 2', 'minecraft-modern-theme' ),
|
||||
'id' => 'homepage-sidebar-middle-2',
|
||||
'description' => __( 'Zweiter Widget-Bereich in der Mitte der Sidebar.', 'minecraft-modern-theme' ),
|
||||
'before_widget' => '<div id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h3 class="widget-title">',
|
||||
'after_title' => '</h3>',
|
||||
) );
|
||||
|
||||
// Unterer Bereich
|
||||
register_sidebar( array(
|
||||
'name' => __( 'Startseiten Sidebar - Unten', 'minecraft-modern-theme' ),
|
||||
'id' => 'homepage-sidebar-bottom',
|
||||
'description' => __( 'Widget-Bereich unten in der Sidebar (z.B. für Social Media).', 'minecraft-modern-theme' ),
|
||||
'before_widget' => '<div id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h3 class="widget-title">',
|
||||
'after_title' => '</h3>',
|
||||
) );
|
||||
|
||||
// Zusätzlicher flexibler Bereich
|
||||
register_sidebar( array(
|
||||
'name' => __( 'Startseiten Sidebar - Extra', 'minecraft-modern-theme' ),
|
||||
'id' => 'homepage-sidebar-extra',
|
||||
'description' => __( 'Zusätzlicher Widget-Bereich für spezielle Inhalte.', 'minecraft-modern-theme' ),
|
||||
'before_widget' => '<div id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h3 class="widget-title">',
|
||||
'after_title' => '</h3>',
|
||||
) );
|
||||
}
|
||||
add_action( 'widgets_init', 'minecraft_modern_homepage_sidebar' );
|
||||
|
||||
// === FAQ Custom Post Type & Taxonomy ===
|
||||
function create_faq_post_type() {
|
||||
// Nur registrieren, wenn im Customizer aktiviert
|
||||
@@ -428,10 +487,10 @@ function minecraft_modern_scroll_to_top_script() {
|
||||
add_action('wp_enqueue_scripts', 'minecraft_modern_scroll_to_top_script');
|
||||
|
||||
// =============================================================================
|
||||
// === THEME SETTINGS EXPORT / IMPORT (KORRIGIERTE VERSION) =================
|
||||
// === THEME SETTINGS EXPORT / IMPORT (VOLLSTÄNDIG KORRIGIERT) ===============
|
||||
// =============================================================================
|
||||
|
||||
// 1. Export Handler (Download) - ERWEITERT UM TEAM
|
||||
// 1. Export Handler (Download) - ALLE EINSTELLUNGEN
|
||||
add_action( 'admin_post_export_theme_settings', 'handle_theme_settings_export' );
|
||||
|
||||
function handle_theme_settings_export() {
|
||||
@@ -443,25 +502,30 @@ function handle_theme_settings_export() {
|
||||
// Theme Slug ermitteln
|
||||
$theme_slug = get_option( 'stylesheet' );
|
||||
|
||||
// 1. Theme Mods (Customizer & Announcement Settings) holen
|
||||
// 1. Theme Mods (Customizer-Einstellungen) holen
|
||||
$mods = get_theme_mods();
|
||||
|
||||
// 2. Announcement Settings manuell hinzufügen (siehe vorheriger Schritt)
|
||||
$mods['mm_announcement_enabled'] = get_option('mm_announcement_enabled');
|
||||
$mods['mm_announcement_text'] = get_option('mm_announcement_text');
|
||||
$mods['mm_announcement_bg'] = get_option('mm_announcement_bg');
|
||||
$mods['mm_announcement_color'] = get_option('mm_announcement_color');
|
||||
$mods['mm_announcement_font_size'] = get_option('mm_announcement_font_size');
|
||||
$mods['mm_announcement_font_family'] = get_option('mm_announcement_font_family');
|
||||
$mods['mm_announcement_position'] = get_option('mm_announcement_position');
|
||||
$mods['mm_announcement_countdown_enabled'] = get_option('mm_announcement_countdown_enabled');
|
||||
$mods['mm_announcement_countdown_label'] = get_option('mm_announcement_countdown_label');
|
||||
$mods['mm_announcement_countdown_date'] = get_option('mm_announcement_countdown_date');
|
||||
$mods['mm_announcement_countdown_expired_msg'] = get_option('mm_announcement_countdown_expired_msg');
|
||||
// 2. Announcement Settings manuell hinzufügen
|
||||
$announcement_keys = array(
|
||||
'mm_announcement_enabled',
|
||||
'mm_announcement_text',
|
||||
'mm_announcement_bg',
|
||||
'mm_announcement_color',
|
||||
'mm_announcement_font_size',
|
||||
'mm_announcement_font_family',
|
||||
'mm_announcement_position',
|
||||
'mm_announcement_countdown_enabled',
|
||||
'mm_announcement_countdown_label',
|
||||
'mm_announcement_countdown_date',
|
||||
'mm_announcement_countdown_expired_msg'
|
||||
);
|
||||
|
||||
// 3. --- NEU: Team Daten holen ---
|
||||
foreach ( $announcement_keys as $key ) {
|
||||
$mods[$key] = get_option($key);
|
||||
}
|
||||
|
||||
// 3. Team Daten holen
|
||||
$team_data = array();
|
||||
// Hole alle Teammitglieder sortiert nach Reihenfolge
|
||||
$team_query = new WP_Query(array(
|
||||
'post_type' => 'team_member',
|
||||
'posts_per_page' => -1,
|
||||
@@ -470,18 +534,20 @@ function handle_theme_settings_export() {
|
||||
));
|
||||
|
||||
if ( $team_query->have_posts() ) {
|
||||
while ( $team_query->have_posts() ) : $team_query->the_post();
|
||||
while ( $team_query->have_posts() ) {
|
||||
$team_query->the_post();
|
||||
|
||||
$team_data[] = array(
|
||||
'title' => get_the_title(),
|
||||
'content' => get_the_content(),
|
||||
'rank' => get_post_meta( get_the_ID(), '_team_member_rank', true ),
|
||||
'menu_order' => get_post_field( 'menu_order', get_the_ID() ),
|
||||
// Bilder werden NICHT exportiert (siehe Hinweis unten)
|
||||
);
|
||||
endwhile;
|
||||
}
|
||||
wp_reset_postdata(); // WICHTIG: Post-Daten zurücksetzen
|
||||
}
|
||||
|
||||
$mods['team_data'] = $team_data;
|
||||
// --- ENDE TEAM EXPORT ---
|
||||
|
||||
// Daten als JSON vorbereiten
|
||||
$data = json_encode( $mods, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE );
|
||||
@@ -496,7 +562,7 @@ function handle_theme_settings_export() {
|
||||
exit;
|
||||
}
|
||||
|
||||
// 2. Import Handler (AJAX) - ERWEITERT UM TEAM
|
||||
// 2. Import Handler (AJAX) - ALLE EINSTELLUNGEN
|
||||
add_action( 'wp_ajax_import_theme_settings', 'handle_theme_settings_import' );
|
||||
|
||||
function handle_theme_settings_import() {
|
||||
@@ -521,52 +587,70 @@ function handle_theme_settings_import() {
|
||||
wp_send_json_error( __( 'Die hochgeladene Datei ist keine gültige JSON-Datei.', 'minecraft-modern-theme' ) );
|
||||
}
|
||||
|
||||
// 1. Theme Mods & Announcement importieren (siehe vorheriger Code)
|
||||
// Announcement Keys definieren
|
||||
$announcement_keys = array(
|
||||
'mm_announcement_enabled',
|
||||
'mm_announcement_text',
|
||||
'mm_announcement_bg',
|
||||
'mm_announcement_color',
|
||||
'mm_announcement_font_size',
|
||||
'mm_announcement_font_family',
|
||||
'mm_announcement_position',
|
||||
'mm_announcement_countdown_enabled',
|
||||
'mm_announcement_countdown_label',
|
||||
'mm_announcement_countdown_date',
|
||||
'mm_announcement_countdown_expired_msg'
|
||||
);
|
||||
|
||||
// KRITISCHER FIX: Team Daten VORHER extrahieren und aus Array entfernen
|
||||
$team_data = isset($data['team_data']) ? $data['team_data'] : array();
|
||||
unset($data['team_data']); // Verhindert Fehler beim Durchlaufen der Theme Mods
|
||||
|
||||
// 1. Theme Mods & Announcement importieren
|
||||
foreach ( $data as $mod_key => $mod_value ) {
|
||||
// Differenzierung wie beim Export
|
||||
if ( strpos( $mod_key, 'mm_announcement_' ) === 0 ) {
|
||||
// Unterscheidung: Announcement = Option, Rest = Theme Mod
|
||||
if ( in_array( $mod_key, $announcement_keys ) ) {
|
||||
update_option( $mod_key, $mod_value );
|
||||
} else {
|
||||
set_theme_mod( $mod_key, $mod_value );
|
||||
}
|
||||
}
|
||||
|
||||
// 2. --- NEU: Team Daten importieren ---
|
||||
if ( isset( $data['team_data'] ) && ! empty( $data['team_data'] ) ) {
|
||||
// 2. Team Daten importieren
|
||||
if ( ! empty( $team_data ) ) {
|
||||
|
||||
// Option 1: Vorherige Team-Mitglieder löschen (Clean Import)
|
||||
// Wir force-delete alle Posts, damit die Liste exakt so ist wie im Backup.
|
||||
// Vorherige Team-Mitglieder löschen (Clean Import)
|
||||
$existing_team = new WP_Query(array(
|
||||
'post_type' => 'team_member',
|
||||
'posts_per_page' => -1,
|
||||
'fields' => 'ids' // Nur IDs holen, schneller
|
||||
'fields' => 'ids'
|
||||
));
|
||||
|
||||
if ( $existing_team->have_posts() ) {
|
||||
while ( $existing_team->have_posts() ) {
|
||||
wp_delete_post( $existing_team->next_post()->ID, true ); // true = force delete
|
||||
foreach ( $existing_team->posts as $post_id ) {
|
||||
wp_delete_post( $post_id, true ); // true = permanent löschen
|
||||
}
|
||||
}
|
||||
wp_reset_postdata(); // WICHTIG: Post-Daten zurücksetzen
|
||||
|
||||
// Neue Mitglieder anlegen
|
||||
foreach ( $data['team_data'] as $member ) {
|
||||
$id = wp_insert_post(array(
|
||||
foreach ( $team_data as $member ) {
|
||||
$new_id = wp_insert_post(array(
|
||||
'post_title' => sanitize_text_field( $member['title'] ),
|
||||
'post_content' => sanitize_textarea_field( $member['content'] ),
|
||||
'post_type' => 'team_member',
|
||||
'post_status' => 'publish',
|
||||
'post_status' => 'publish',
|
||||
'menu_order' => isset( $member['menu_order'] ) ? intval( $member['menu_order'] ) : 0
|
||||
));
|
||||
|
||||
if ( $id && ! is_wp_error( $id ) ) {
|
||||
if ( $new_id && ! is_wp_error( $new_id ) ) {
|
||||
// Rang als Meta-Data speichern
|
||||
if ( isset( $member['rank'] ) ) {
|
||||
update_post_meta( $id, '_team_member_rank', sanitize_text_field( $member['rank'] ) );
|
||||
update_post_meta( $new_id, '_team_member_rank', sanitize_text_field( $member['rank'] ) );
|
||||
}
|
||||
// Bilder werden NICFT importiert (siehe Hinweis unten)
|
||||
}
|
||||
}
|
||||
}
|
||||
// --- ENDE TEAM IMPORT ---
|
||||
|
||||
wp_send_json_success( __( 'Einstellungen und Team erfolgreich importiert! Bilder müssen ggf. neu hochgeladen werden.', 'minecraft-modern-theme' ) );
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
* - Social Media
|
||||
* - Footer
|
||||
* - Login
|
||||
* - Sidebar
|
||||
* - Import/Export
|
||||
*/
|
||||
|
||||
@@ -198,7 +199,47 @@ function minecraft_modern_customize_register( $wp_customize ) {
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// === 3. SOCIAL MEDIA =====================================================
|
||||
// === 3. SIDEBAR EINSTELLUNGEN ============================================
|
||||
// =========================================================================
|
||||
|
||||
$wp_customize->add_section( 'sidebar_settings', array(
|
||||
'title' => 'Sidebar Einstellungen',
|
||||
'priority' => 35,
|
||||
'description' => 'Konfiguriere die Sidebar auf der Startseite.',
|
||||
) );
|
||||
|
||||
// Sidebar aktivieren
|
||||
$wp_customize->add_setting( 'homepage_sidebar_enabled', array(
|
||||
'default' => false,
|
||||
'sanitize_callback' => 'wp_validate_boolean',
|
||||
) );
|
||||
$wp_customize->add_control( 'homepage_sidebar_enabled', array(
|
||||
'label' => 'Sidebar auf Startseite aktivieren',
|
||||
'description' => 'Zeigt eine Sidebar neben dem Hauptinhalt an.',
|
||||
'section' => 'sidebar_settings',
|
||||
'settings' => 'homepage_sidebar_enabled',
|
||||
'type' => 'checkbox',
|
||||
) );
|
||||
|
||||
// Sidebar Position
|
||||
$wp_customize->add_setting( 'homepage_sidebar_position', array(
|
||||
'default' => 'right',
|
||||
'sanitize_callback' => 'sanitize_key',
|
||||
) );
|
||||
$wp_customize->add_control( 'homepage_sidebar_position', array(
|
||||
'label' => 'Sidebar Position',
|
||||
'section' => 'sidebar_settings',
|
||||
'settings' => 'homepage_sidebar_position',
|
||||
'type' => 'select',
|
||||
'choices' => array(
|
||||
'left' => 'Links',
|
||||
'right' => 'Rechts',
|
||||
),
|
||||
) );
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// === 4. SOCIAL MEDIA =====================================================
|
||||
// =========================================================================
|
||||
|
||||
$wp_customize->add_section( 'social_links', array( 'title' => 'Social Media Links', 'priority' => 40 ) );
|
||||
@@ -212,7 +253,7 @@ function minecraft_modern_customize_register( $wp_customize ) {
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// === 4. FOOTER-BEREICH ==================================================
|
||||
// === 5. FOOTER-BEREICH ==================================================
|
||||
// =========================================================================
|
||||
|
||||
$wp_customize->add_section( 'footer_settings', array( 'title' => 'Footer-Einstellungen', 'priority' => 50 ) );
|
||||
@@ -241,7 +282,7 @@ function minecraft_modern_customize_register( $wp_customize ) {
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// === 5. ZUSÄTZLICHE FUNKTIONEN ==========================================
|
||||
// === 6. ZUSÄTZLICHE FUNKTIONEN ==========================================
|
||||
// =========================================================================
|
||||
|
||||
// --- Sektion: FAQ Einstellungen ---
|
||||
@@ -251,7 +292,7 @@ function minecraft_modern_customize_register( $wp_customize ) {
|
||||
'label' => 'FAQ System aktivieren', 'section' => 'faq_settings', 'settings' => 'faq_enabled', 'type' => 'checkbox',
|
||||
) );
|
||||
|
||||
// --- Sektion: Team Einstellungen ---
|
||||
// --- Sektion: Team Einstellungen ---
|
||||
$wp_customize->add_section( 'team_settings', array( 'title' => 'Team Einstellungen', 'priority' => 65 ) );
|
||||
$wp_customize->add_setting( 'team_enabled', array( 'default' => true, 'sanitize_callback' => 'wp_validate_boolean' ) );
|
||||
$wp_customize->add_control( 'team_enabled', array(
|
||||
@@ -259,7 +300,7 @@ function minecraft_modern_customize_register( $wp_customize ) {
|
||||
) );
|
||||
|
||||
// =========================================================================
|
||||
// === 6. LOGIN-BEREICH ====================================================
|
||||
// === 7. LOGIN-BEREICH ====================================================
|
||||
// =========================================================================
|
||||
|
||||
$wp_customize->add_section( 'login_settings', array(
|
||||
@@ -321,7 +362,7 @@ function minecraft_modern_customize_register( $wp_customize ) {
|
||||
) );
|
||||
|
||||
// =========================================================================
|
||||
// === 7. EXPORT / IMPORT SECTION =========================================
|
||||
// === 8. EXPORT / IMPORT SECTION =========================================
|
||||
// =========================================================================
|
||||
|
||||
$wp_customize->add_section( 'theme_mods_import_export', array(
|
||||
|
||||
@@ -5,121 +5,156 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// === ZENTRALE VERSIONSKONSTANTE ===
|
||||
// Bitte passen Sie diese Version bei jedem Release an!
|
||||
define( 'MINECRAFT_MODERN_THEME_VERSION', '1.6' );
|
||||
// === THEME VERSION AUTOMATISCH AUS style.css LADEN (PARENT THEME PRIORITÄT) ===
|
||||
function minecraft_modern_get_theme_version() {
|
||||
// Holt das aktuell aktive Theme (child oder parent)
|
||||
$theme = wp_get_theme();
|
||||
|
||||
// Wenn ein Child-Theme aktiv ist und ein Parent vorhanden ist, nutze die Parent-Version
|
||||
$parent = $theme->parent();
|
||||
if ( $parent && $parent->exists() ) {
|
||||
$parent_version = $parent->get( 'Version' );
|
||||
if ( ! empty( $parent_version ) ) {
|
||||
return $parent_version;
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback: Version des aktuell aktiven Themes (wenn kein Parent existiert oder Parent keine Version hat)
|
||||
return $theme->get( 'Version' );
|
||||
}
|
||||
|
||||
// === THEME UPDATE NOTIFICATION SYSTEM ===
|
||||
|
||||
// Funktion zum Abrufen der neuesten Release-Informationen vom Git-Repository
|
||||
function minecraft_modern_get_latest_release_info() {
|
||||
// Funktion zum Leeren des Caches (wenn man auf "Update prüfen" klickt)
|
||||
function minecraft_modern_clear_cache() {
|
||||
if ( isset( $_GET['mm_clear_cache'] ) && current_user_can( 'manage_options' ) ) {
|
||||
check_admin_referer( 'mm_clear_cache_action' );
|
||||
delete_transient( 'minecraft_modern_latest_release' );
|
||||
wp_redirect( admin_url( 'index.php' ) );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
add_action( 'admin_init', 'minecraft_modern_clear_cache' );
|
||||
|
||||
// Funktion zum Abrufen der neuesten Release-Informationen
|
||||
function minecraft_modern_get_latest_release_info( $force_refresh = false ) {
|
||||
$transient_key = 'minecraft_modern_latest_release';
|
||||
|
||||
// Versuche, die Daten aus dem Transient-Cache zu holen
|
||||
$release_info = get_transient($transient_key);
|
||||
// Wenn erzwungen wird (oder Cache leer), frische Daten holen
|
||||
if ( $force_refresh ) {
|
||||
delete_transient( $transient_key );
|
||||
}
|
||||
|
||||
// Wenn der Cache leer oder abgelaufen ist, rufe neue Daten ab
|
||||
if (false === $release_info) {
|
||||
$response = wp_remote_get('https://git.viper.ipv64.net/api/v1/repos/M_Viper/Minecraft-Modern-Theme/releases/latest');
|
||||
$release_info = get_transient( $transient_key );
|
||||
|
||||
if ( false === $release_info ) {
|
||||
// Timeout auf 10 Sekunden erhöht für langsame Verbindungen
|
||||
$response = wp_remote_get(
|
||||
'https://git.viper.ipv64.net/api/v1/repos/M_Viper/Minecraft-Modern-Theme/releases/latest',
|
||||
array( 'timeout' => 10 )
|
||||
);
|
||||
|
||||
if (!is_wp_error($response) && 200 === wp_remote_retrieve_response_code($response)) {
|
||||
$body = wp_remote_retrieve_body($response);
|
||||
$release_data = json_decode($body, true);
|
||||
if ( ! is_wp_error( $response ) && 200 === wp_remote_retrieve_response_code( $response ) ) {
|
||||
$body = wp_remote_retrieve_body( $response );
|
||||
$release_data = json_decode( $body, true );
|
||||
|
||||
if ($release_data && isset($release_data['tag_name'])) {
|
||||
if ( $release_data && isset( $release_data['tag_name'] ) ) {
|
||||
// Tag bereinigen (falls 'v' davor steht, z.B. v1.6 -> 1.6)
|
||||
$tag_name = $release_data['tag_name'];
|
||||
if ( strpos( $tag_name, 'v' ) === 0 ) {
|
||||
$tag_name = ltrim( $tag_name, 'v' );
|
||||
}
|
||||
|
||||
$release_info = array(
|
||||
'version' => $release_data['tag_name'],
|
||||
'download_url' => $release_data['zipball_url'],
|
||||
'release_notes' => isset($release_data['body']) ? $release_data['body'] : '',
|
||||
'published_at' => isset($release_data['published_at']) ? $release_data['published_at'] : ''
|
||||
'version' => $tag_name,
|
||||
'download_url' => $release_data['zipball_url'],
|
||||
'release_notes' => isset( $release_data['body'] ) ? $release_data['body'] : '',
|
||||
'published_at' => isset( $release_data['published_at'] ) ? $release_data['published_at'] : ''
|
||||
);
|
||||
|
||||
// Speichere die Daten für 12 Stunden im Cache
|
||||
set_transient($transient_key, $release_info, 12 * HOUR_IN_SECONDS);
|
||||
// Cache für 6 Stunden
|
||||
set_transient( $transient_key, $release_info, 6 * HOUR_IN_SECONDS );
|
||||
} else {
|
||||
// Fehlerhafte Daten leer cachen
|
||||
set_transient( $transient_key, array(), HOUR_IN_SECONDS );
|
||||
}
|
||||
} else {
|
||||
// Bei Fehler, leere Daten für 1 Stunde cachen, um wiederholte fehlgeschlagene Anfragen zu vermeiden
|
||||
set_transient($transient_key, array(), HOUR_IN_SECONDS);
|
||||
// Fehler beim Abrufen
|
||||
set_transient( $transient_key, array(), HOUR_IN_SECONDS );
|
||||
}
|
||||
}
|
||||
|
||||
return $release_info;
|
||||
}
|
||||
|
||||
// Funktion zum Anzeigen der Update-Benachrichtigung im Admin-Bereich
|
||||
// === BENACHRICHTIGUNG IM ADMIN-BEREICH ===
|
||||
function minecraft_modern_show_update_notification() {
|
||||
// Nur im Admin-Bereich und für Administratoren anzeigen
|
||||
if (!is_admin() || !current_user_can('manage_options')) {
|
||||
if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Aktuelle Theme-Version abrufen (JETZT AUS UNSERER KONSTANTE)
|
||||
$current_version = MINECRAFT_MODERN_THEME_VERSION;
|
||||
$current_version = minecraft_modern_get_theme_version();
|
||||
$latest_release = minecraft_modern_get_latest_release_info();
|
||||
|
||||
// Neueste Release-Informationen abrufen
|
||||
$latest_release = minecraft_modern_get_latest_release_info();
|
||||
|
||||
// Wenn wir gültige Release-Informationen haben und die Versionen unterschiedlich sind
|
||||
if (!empty($latest_release) && isset($latest_release['version']) && version_compare($current_version, $latest_release['version'], '<')) {
|
||||
if ( ! empty( $latest_release ) && isset( $latest_release['version'] ) && version_compare( $current_version, $latest_release['version'], '<' ) ) {
|
||||
?>
|
||||
<div class="notice notice-warning is-dismissible">
|
||||
<h3><?php _e('Minecraft Modern Theme Update Available', 'minecraft-modern-theme'); ?></h3>
|
||||
<h3><?php _e( 'Minecraft Modern Theme Update Available', 'minecraft-modern-theme' ); ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
__('You are using version %1$s of the Minecraft Modern Theme. Version %2$s is now available.', 'minecraft-modern-theme'),
|
||||
'<strong>' . esc_html($current_version) . '</strong>',
|
||||
'<strong>' . esc_html($latest_release['version']) . '</strong>'
|
||||
__( 'You are using version %1$s of the Minecraft Modern Theme. Version %2$s is now available.', 'minecraft-modern-theme' ),
|
||||
'<strong>' . esc_html( $current_version ) . '</strong>',
|
||||
'<strong>' . esc_html( $latest_release['version'] ) . '</strong>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<a href="<?php echo esc_url($latest_release['download_url']); ?>" class="button button-primary" target="_blank">
|
||||
<?php _e('Download Latest Version', 'minecraft-modern-theme'); ?>
|
||||
<a href="<?php echo esc_url( $latest_release['download_url'] ); ?>" class="button button-primary" target="_blank">
|
||||
<?php _e( 'Download Latest Version', 'minecraft-modern-theme' ); ?>
|
||||
</a>
|
||||
<a href="https://git.viper.ipv64.net/M_Viper/Minecraft-Modern-Theme/releases" class="button" target="_blank">
|
||||
<?php _e('View Release Notes', 'minecraft-modern-theme'); ?>
|
||||
<?php _e( 'View Release Notes', 'minecraft-modern-theme' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
add_action('admin_notices', 'minecraft_modern_show_update_notification');
|
||||
add_action( 'admin_notices', 'minecraft_modern_show_update_notification' );
|
||||
|
||||
// Funktion zum Hinzufügen eines Update-Status-Widgets zum Dashboard
|
||||
// === DASHBOARD WIDGET ===
|
||||
function minecraft_modern_add_dashboard_widget() {
|
||||
wp_add_dashboard_widget(
|
||||
'minecraft_modern_update_widget', // Widget slug.
|
||||
'Minecraft Modern Theme Status', // Title.
|
||||
'minecraft_modern_update_widget_function' // Display function.
|
||||
'minecraft_modern_update_widget',
|
||||
'Minecraft Modern Theme Status',
|
||||
'minecraft_modern_update_widget_function'
|
||||
);
|
||||
}
|
||||
add_action('wp_dashboard_setup', 'minecraft_modern_add_dashboard_widget');
|
||||
add_action( 'wp_dashboard_setup', 'minecraft_modern_add_dashboard_widget' );
|
||||
|
||||
// Funktion zum Anzeigen des Inhalts im Dashboard-Widget
|
||||
function minecraft_modern_update_widget_function() {
|
||||
// Aktuelle Theme-Version abrufen (JETZT AUS UNSERER KONSTANTE)
|
||||
$current_version = MINECRAFT_MODERN_THEME_VERSION;
|
||||
$current_version = minecraft_modern_get_theme_version();
|
||||
$latest_release = minecraft_modern_get_latest_release_info();
|
||||
|
||||
// Neueste Release-Informationen abrufen
|
||||
$latest_release = minecraft_modern_get_latest_release_info();
|
||||
echo '<p><strong>' . __( 'Current Version:', 'minecraft-modern-theme' ) . '</strong> ' . esc_html( $current_version ) . '</p>';
|
||||
|
||||
echo '<p><strong>' . __('Current Version:', 'minecraft-modern-theme') . '</strong> ' . esc_html($current_version) . '</p>';
|
||||
|
||||
if (!empty($latest_release) && isset($latest_release['version'])) {
|
||||
if (version_compare($current_version, $latest_release['version'], '<')) {
|
||||
echo '<p><strong>' . __('Latest Version:', 'minecraft-modern-theme') . '</strong> <span style="color: #d63638;">' . esc_html($latest_release['version']) . '</span></p>';
|
||||
echo '<p><strong>' . __('Status:', 'minecraft-modern-theme') . '</strong> <span style="color: #d63638;">' . __('Update Available', 'minecraft-modern-theme') . '</span></p>';
|
||||
echo '<p><a href="' . esc_url($latest_release['download_url']) . '" class="button button-primary" target="_blank">' . __('Download Update', 'minecraft-modern-theme') . '</a></p>';
|
||||
if ( ! empty( $latest_release ) && isset( $latest_release['version'] ) ) {
|
||||
echo '<p><strong>' . __( 'Latest Version:', 'minecraft-modern-theme' ) . '</strong> ' . esc_html( $latest_release['version'] ) . '</p>';
|
||||
|
||||
if ( version_compare( $current_version, $latest_release['version'], '<' ) ) {
|
||||
echo '<p><strong>' . __( 'Status:', 'minecraft-modern-theme' ) . '</strong> <span style="color:#d63638;">' . __( 'Update Available', 'minecraft-modern-theme' ) . '</span></p>';
|
||||
echo '<p><a href="' . esc_url( $latest_release['download_url'] ) . '" class="button button-primary" target="_blank">' . __( 'Download Update', 'minecraft-modern-theme' ) . '</a></p>';
|
||||
} else {
|
||||
echo '<p><strong>' . __('Latest Version:', 'minecraft-modern-theme') . '</strong> <span style="color: #46b450;">' . esc_html($latest_release['version']) . '</span></p>';
|
||||
echo '<p><strong>' . __('Status:', 'minecraft-modern-theme') . '</strong> <span style="color: #46b450;">' . __('Up to Date', 'minecraft-modern-theme') . '</span></p>';
|
||||
echo '<p><strong>' . __( 'Status:', 'minecraft-modern-theme' ) . '</strong> <span style="color:#46b450;">' . __( 'Up to Date', 'minecraft-modern-theme' ) . '</span></p>';
|
||||
}
|
||||
} else {
|
||||
echo '<p><strong>' . __('Status:', 'minecraft-modern-theme') . '</strong> ' . __('Unable to check for updates', 'minecraft-modern-theme') . '</p>';
|
||||
echo '<p><strong>' . __( 'Status:', 'minecraft-modern-theme' ) . '</strong> ' . __( 'Unable to check for updates', 'minecraft-modern-theme' ) . '</p>';
|
||||
}
|
||||
|
||||
echo '<p><a href="https://git.viper.ipv64.net/M_Viper/Minecraft-Modern-Theme/releases" target="_blank">' . __('View All Releases', 'minecraft-modern-theme') . '</a></p>';
|
||||
}
|
||||
// Link für "Jetzt prüfen"
|
||||
$refresh_url = wp_nonce_url( admin_url( 'index.php?mm_clear_cache=1' ), 'mm_clear_cache_action' );
|
||||
echo '<p><a href="' . esc_url( $refresh_url ) . '" onclick="return confirm(\'Cache leeren und neu prüfen?\');">' . __( 'Check for Updates Now', 'minecraft-modern-theme' ) . '</a></p>';
|
||||
|
||||
echo '<p><a href="https://git.viper.ipv64.net/M_Viper/Minecraft-Modern-Theme/releases" target="_blank">' . __( 'View All Releases', 'minecraft-modern-theme' ) . '</a></p>';
|
||||
}
|
||||
|
||||
@@ -4,12 +4,223 @@ Theme URI: https://git.viper.ipv64.net/M_Viper/Minecraft-Modern-Theme
|
||||
Author: M_Viper
|
||||
Description: Ein modernes Gaming-Theme mit konfigurierbarem Header-Slider.
|
||||
Author URI: https://M-Viper.de
|
||||
Version: 1.6
|
||||
Version: 1.8
|
||||
License: GNU General Public License v2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
Text Domain: minecraft-modern-theme
|
||||
*/
|
||||
|
||||
/* === FRONT-PAGE WIDGET CSS === */
|
||||
.homepage-sidebar .widget {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.homepage-sidebar .widget:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.homepage-sidebar .widget-title {
|
||||
font-size: 1.2rem;
|
||||
margin-bottom: 15px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 2px solid var(--primary-accent, #00d4ff);
|
||||
color: var(--primary-accent, #00d4ff);
|
||||
}
|
||||
|
||||
.homepage-sidebar ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.homepage-sidebar ul li {
|
||||
padding: 8px 0;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.homepage-sidebar ul li:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.homepage-sidebar a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
|
||||
.homepage-sidebar a:hover {
|
||||
color: var(--primary-accent, #00d4ff);
|
||||
}
|
||||
/* === FRONT-PAGE SIDEBAR LAYOUT === */
|
||||
.content-area .main-content {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.content-area.with-sidebar {
|
||||
display: grid;
|
||||
gap: 30px;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.content-area.with-sidebar.sidebar-right {
|
||||
grid-template-columns: 1fr 300px;
|
||||
}
|
||||
|
||||
.content-area.with-sidebar.sidebar-right .main-content {
|
||||
order: 1;
|
||||
}
|
||||
|
||||
.content-area.with-sidebar.sidebar-right .homepage-sidebar {
|
||||
order: 2;
|
||||
}
|
||||
|
||||
.content-area.with-sidebar.sidebar-left {
|
||||
grid-template-columns: 300px 1fr;
|
||||
}
|
||||
|
||||
.content-area.with-sidebar.sidebar-left .homepage-sidebar {
|
||||
order: 1;
|
||||
}
|
||||
|
||||
.content-area.with-sidebar.sidebar-left .main-content {
|
||||
order: 2;
|
||||
}
|
||||
|
||||
.homepage-sidebar {
|
||||
position: relative !important;
|
||||
top: auto !important;
|
||||
background: var(--card-background, #1e2029);
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
overflow-y: auto;
|
||||
max-height: calc(200vh - 10vh);
|
||||
}
|
||||
|
||||
.homepage-sidebar .sidebar-section {
|
||||
margin-bottom: 30px;
|
||||
padding-bottom: 20px;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.homepage-sidebar .sidebar-section:last-child {
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 0;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.homepage-sidebar .sidebar-top {
|
||||
border-bottom: 2px solid var(--primary-accent, #00d4ff);
|
||||
}
|
||||
|
||||
.homepage-sidebar .sidebar-bottom {
|
||||
padding-top: 20px;
|
||||
border-top: 2px solid var(--primary-accent, #00d4ff);
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.homepage-sidebar .widget {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.homepage-sidebar .widget:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.homepage-sidebar .widget-title {
|
||||
font-size: 1.2rem;
|
||||
margin-bottom: 15px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 2px solid var(--primary-accent, #00d4ff);
|
||||
color: var(--primary-accent, #00d4ff);
|
||||
}
|
||||
|
||||
.homepage-sidebar ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.homepage-sidebar ul li {
|
||||
padding: 8px 0;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.homepage-sidebar ul li:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.homepage-sidebar a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
|
||||
.homepage-sidebar a:hover {
|
||||
color: var(--primary-accent, #00d4ff);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.content-area.with-sidebar.sidebar-right,
|
||||
.content-area.with-sidebar.sidebar-left {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.content-area.with-sidebar .homepage-sidebar {
|
||||
order: 3 !important;
|
||||
position: relative;
|
||||
top: 0;
|
||||
max-height: none;
|
||||
}
|
||||
|
||||
.content-area.with-sidebar .main-content {
|
||||
order: 1 !important;
|
||||
}
|
||||
}
|
||||
|
||||
body.dark-mode .homepage-sidebar {
|
||||
background: #1e1e1e;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
body.dark-mode .homepage-sidebar ul li {
|
||||
border-bottom-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
body.light-mode .homepage-sidebar {
|
||||
background: #ffffff;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
body.light-mode .homepage-sidebar .sidebar-section {
|
||||
border-bottom-color: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
body.light-mode .homepage-sidebar ul li {
|
||||
border-bottom-color: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
body.light-mode .homepage-sidebar .widget-title {
|
||||
color: var(--primary-accent, #00d4ff);
|
||||
}
|
||||
|
||||
.homepage-sidebar::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
.homepage-sidebar::-webkit-scrollbar-track {
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.homepage-sidebar::-webkit-scrollbar-thumb {
|
||||
background: var(--primary-accent, #00d4ff);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.homepage-sidebar::-webkit-scrollbar-thumb:hover {
|
||||
background: var(--primary-accent-hover, #00b8e6);
|
||||
}
|
||||
|
||||
@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@400;600;700&display=swap');
|
||||
|
||||
/* === DARK / LIGHT MODE VARIABLEN === */
|
||||
@@ -91,11 +302,6 @@ a:hover { color: #fff; }
|
||||
gap: 40px; /* Flexiblerer Abstand */
|
||||
}
|
||||
|
||||
/* WICHTIG: Typo im Header.html korrigieren!
|
||||
HTML: <div class="site-branding">
|
||||
CSS: .site-branding
|
||||
Sie müssen die 'g' im HTML oder CSS angleichen, sonst ist das Layout kaputt.
|
||||
*/
|
||||
.site-branding {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -1283,4 +1489,5 @@ body.home-title-hidden .site-main .page-header {
|
||||
height: 120px;
|
||||
margin-top: -40px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user