Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9df80d7237 | |||
| 27f6a15aae | |||
| 638808d9dd | |||
| ca9815ea65 | |||
| 568acd83d1 | |||
| 985ba164a1 | |||
| 77536986ab | |||
| 39e9b298d9 | |||
| 37b31a6109 | |||
| b7276ff373 | |||
| 02b94594b9 | |||
| d76950645e | |||
| dbea7c74f3 | |||
| ae10138d51 | |||
| 991d9c38c8 | |||
| 4ad76fabf6 | |||
| d46684dc7e | |||
| dc14b838d6 | |||
| f397108cf0 | |||
| 6896f6aa26 | |||
| e119411758 | |||
| 50c636a17f | |||
| 9051f74598 | |||
| 777a999fed | |||
| d27c2b1259 | |||
| cc36e57079 | |||
| ca6955d579 | |||
| ddbf78a5c0 | |||
| b3638449ea | |||
| 863deb2592 |
@@ -88,12 +88,71 @@ if ( get_theme_mod('slider_enabled', false) ) :
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<!-- ===================================================== -->
|
<!-- ===================================================== -->
|
||||||
<!-- MAIN CONTENT -->
|
<!-- MAIN CONTENT MIT SIDEBAR -->
|
||||||
<!-- ===================================================== -->
|
<!-- ===================================================== -->
|
||||||
<main id="primary" class="site-main">
|
<main id="primary" class="site-main">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="content-area">
|
|
||||||
|
|
||||||
|
<?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 if ( have_posts() ) : ?>
|
||||||
<?php while ( have_posts() ) : the_post(); ?>
|
<?php while ( have_posts() ) : the_post(); ?>
|
||||||
|
|
||||||
@@ -127,9 +186,231 @@ if ( get_theme_mod('slider_enabled', false) ) :
|
|||||||
<p><?php esc_html_e( 'Keine Beiträge gefunden.', 'minecraft-modern-theme' ); ?></p>
|
<p><?php esc_html_e( 'Keine Beiträge gefunden.', 'minecraft-modern-theme' ); ?></p>
|
||||||
|
|
||||||
<?php endif; ?>
|
<?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>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</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(); ?>
|
<?php get_footer(); ?>
|
||||||
@@ -168,6 +168,65 @@ function minecraft_modern_footer_widgets() {
|
|||||||
}
|
}
|
||||||
add_action( 'widgets_init', '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 ===
|
// === FAQ Custom Post Type & Taxonomy ===
|
||||||
function create_faq_post_type() {
|
function create_faq_post_type() {
|
||||||
// Nur registrieren, wenn im Customizer aktiviert
|
// Nur registrieren, wenn im Customizer aktiviert
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
* - Social Media
|
* - Social Media
|
||||||
* - Footer
|
* - Footer
|
||||||
* - Login
|
* - Login
|
||||||
|
* - Sidebar
|
||||||
* - Import/Export
|
* - 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 ) );
|
$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 ) );
|
$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 ---
|
// --- Sektion: FAQ Einstellungen ---
|
||||||
@@ -259,7 +300,7 @@ function minecraft_modern_customize_register( $wp_customize ) {
|
|||||||
) );
|
) );
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
// === 6. LOGIN-BEREICH ====================================================
|
// === 7. LOGIN-BEREICH ====================================================
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
$wp_customize->add_section( 'login_settings', array(
|
$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(
|
$wp_customize->add_section( 'theme_mods_import_export', array(
|
||||||
|
|||||||
@@ -5,8 +5,23 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// === ZENTRALE VERSIONSKONSTANTE ===
|
// === THEME VERSION AUTOMATISCH AUS style.css LADEN (PARENT THEME PRIORITÄT) ===
|
||||||
define( 'MINECRAFT_MODERN_THEME_VERSION', '1.6' );
|
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 ===
|
// === THEME UPDATE NOTIFICATION SYSTEM ===
|
||||||
|
|
||||||
@@ -34,7 +49,10 @@ function minecraft_modern_get_latest_release_info( $force_refresh = false ) {
|
|||||||
|
|
||||||
if ( false === $release_info ) {
|
if ( false === $release_info ) {
|
||||||
// Timeout auf 10 Sekunden erhöht für langsame Verbindungen
|
// 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 ) );
|
$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 ) ) {
|
if ( ! is_wp_error( $response ) && 200 === wp_remote_retrieve_response_code( $response ) ) {
|
||||||
$body = wp_remote_retrieve_body( $response );
|
$body = wp_remote_retrieve_body( $response );
|
||||||
@@ -54,7 +72,7 @@ function minecraft_modern_get_latest_release_info( $force_refresh = false ) {
|
|||||||
'published_at' => isset( $release_data['published_at'] ) ? $release_data['published_at'] : ''
|
'published_at' => isset( $release_data['published_at'] ) ? $release_data['published_at'] : ''
|
||||||
);
|
);
|
||||||
|
|
||||||
// Cache für 6 Stunden (kannst du anpassen)
|
// Cache für 6 Stunden
|
||||||
set_transient( $transient_key, $release_info, 6 * HOUR_IN_SECONDS );
|
set_transient( $transient_key, $release_info, 6 * HOUR_IN_SECONDS );
|
||||||
} else {
|
} else {
|
||||||
// Fehlerhafte Daten leer cachen
|
// Fehlerhafte Daten leer cachen
|
||||||
@@ -69,13 +87,13 @@ function minecraft_modern_get_latest_release_info( $force_refresh = false ) {
|
|||||||
return $release_info;
|
return $release_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Benachrichtigung im Admin-Bereich
|
// === BENACHRICHTIGUNG IM ADMIN-BEREICH ===
|
||||||
function minecraft_modern_show_update_notification() {
|
function minecraft_modern_show_update_notification() {
|
||||||
if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
|
if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$current_version = MINECRAFT_MODERN_THEME_VERSION;
|
$current_version = minecraft_modern_get_theme_version();
|
||||||
$latest_release = minecraft_modern_get_latest_release_info();
|
$latest_release = minecraft_modern_get_latest_release_info();
|
||||||
|
|
||||||
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'], '<' ) ) {
|
||||||
@@ -105,7 +123,7 @@ function minecraft_modern_show_update_notification() {
|
|||||||
}
|
}
|
||||||
add_action( 'admin_notices', 'minecraft_modern_show_update_notification' );
|
add_action( 'admin_notices', 'minecraft_modern_show_update_notification' );
|
||||||
|
|
||||||
// Dashboard Widget
|
// === DASHBOARD WIDGET ===
|
||||||
function minecraft_modern_add_dashboard_widget() {
|
function minecraft_modern_add_dashboard_widget() {
|
||||||
wp_add_dashboard_widget(
|
wp_add_dashboard_widget(
|
||||||
'minecraft_modern_update_widget',
|
'minecraft_modern_update_widget',
|
||||||
@@ -116,7 +134,7 @@ function minecraft_modern_add_dashboard_widget() {
|
|||||||
add_action( 'wp_dashboard_setup', 'minecraft_modern_add_dashboard_widget' );
|
add_action( 'wp_dashboard_setup', 'minecraft_modern_add_dashboard_widget' );
|
||||||
|
|
||||||
function minecraft_modern_update_widget_function() {
|
function minecraft_modern_update_widget_function() {
|
||||||
$current_version = MINECRAFT_MODERN_THEME_VERSION;
|
$current_version = minecraft_modern_get_theme_version();
|
||||||
$latest_release = minecraft_modern_get_latest_release_info();
|
$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>';
|
||||||
@@ -134,7 +152,7 @@ function minecraft_modern_update_widget_function() {
|
|||||||
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>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Link für "Jetzt prüfen" hinzugefügt
|
// Link für "Jetzt prüfen"
|
||||||
$refresh_url = wp_nonce_url( admin_url( 'index.php?mm_clear_cache=1' ), 'mm_clear_cache_action' );
|
$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="' . esc_url( $refresh_url ) . '" onclick="return confirm(\'Cache leeren und neu prüfen?\');">' . __( 'Check for Updates Now', 'minecraft-modern-theme' ) . '</a></p>';
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Theme URI: https://git.viper.ipv64.net/M_Viper/Minecraft-Modern-Theme
|
|||||||
Author: M_Viper
|
Author: M_Viper
|
||||||
Description: Ein modernes Gaming-Theme mit konfigurierbarem Header-Slider.
|
Description: Ein modernes Gaming-Theme mit konfigurierbarem Header-Slider.
|
||||||
Author URI: https://M-Viper.de
|
Author URI: https://M-Viper.de
|
||||||
Version: 1.6
|
Version: 1.9
|
||||||
License: GNU General Public License v2 or later
|
License: GNU General Public License v2 or later
|
||||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
Text Domain: minecraft-modern-theme
|
Text Domain: minecraft-modern-theme
|
||||||
|
|||||||
Reference in New Issue
Block a user