71 lines
2.9 KiB
PHP
71 lines
2.9 KiB
PHP
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
|
|
<div class="wmw-wiki-index" style="--wmw-accent:<?php echo esc_attr($color); ?>">
|
|
|
|
<!-- Wiki Header -->
|
|
<div class="wmw-wiki-index__header">
|
|
<div class="wmw-wiki-index__icon"><?php echo $icon; ?></div>
|
|
<div class="wmw-wiki-index__info">
|
|
<h1 class="wmw-wiki-index__title"><?php echo esc_html($wiki->post_title); ?></h1>
|
|
<?php if ($wiki->post_excerpt): ?>
|
|
<p class="wmw-wiki-index__desc"><?php echo esc_html($wiki->post_excerpt); ?></p>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php $ver = get_post_meta($wiki->ID,'_wmw_version',true);
|
|
if ($ver): ?>
|
|
<span class="wmw-version-badge">v<?php echo esc_html($ver); ?></span>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<!-- Search Box -->
|
|
<?php WMW_Frontend::render_search_box($wiki->ID); ?>
|
|
|
|
<!-- Intro Content -->
|
|
<?php if ($wiki->post_content): ?>
|
|
<div class="wmw-wiki-index__intro">
|
|
<?php echo apply_filters('the_content', $wiki->post_content); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<!-- Articles by Category -->
|
|
<?php
|
|
$has_cats = false;
|
|
foreach ($grouped as $cat_id => $cat_articles):
|
|
if (empty($cat_articles)) continue;
|
|
$has_cats = true;
|
|
$cat_name = $cat_id === 'uncategorized' ? '📄 Allgemein' : (isset($cat_map[$cat_id]) ? $cat_map[$cat_id]->name : 'Sonstige');
|
|
?>
|
|
<div class="wmw-wiki-section">
|
|
<h2 class="wmw-wiki-section__title"><?php echo esc_html($cat_name); ?></h2>
|
|
<div class="wmw-article-grid">
|
|
<?php foreach ($cat_articles as $art):
|
|
$tags = get_the_terms($art->ID, 'wmw_tag');
|
|
?>
|
|
<a href="<?php echo get_permalink($art->ID); ?>" class="wmw-article-card">
|
|
<div class="wmw-article-card__body">
|
|
<h3 class="wmw-article-card__title"><?php echo esc_html($art->post_title); ?></h3>
|
|
<?php if ($art->post_excerpt): ?>
|
|
<p class="wmw-article-card__excerpt"><?php echo esc_html(wp_trim_words($art->post_excerpt, 15)); ?></p>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php if ($tags && !is_wp_error($tags)): ?>
|
|
<div class="wmw-article-card__tags">
|
|
<?php foreach(array_slice($tags,0,3) as $tag): ?>
|
|
<span class="wmw-tag"><?php echo esc_html($tag->name); ?></span>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
<div class="wmw-article-card__arrow">→</div>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
<?php endforeach;
|
|
|
|
if (!$has_cats && empty($grouped['uncategorized'])):
|
|
?>
|
|
<div class="wmw-empty-state wmw-empty-state--inline">
|
|
<p>Noch keine Artikel in diesem Wiki.</p>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
</div>
|