Update from Git Manager GUI
This commit is contained in:
111
templates/admin/article-form.php
Normal file
111
templates/admin/article-form.php
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
$is_edit = isset( $article ) && $article;
|
||||
$page_title = $is_edit ? 'Artikel bearbeiten' : 'Neuer Artikel';
|
||||
$article_id = $is_edit ? $article->ID : 0;
|
||||
$a_title = $is_edit ? $article->post_title : '';
|
||||
$a_content = $is_edit ? $article->post_content : '';
|
||||
$a_excerpt = $is_edit ? $article->post_excerpt : '';
|
||||
$a_wiki_id = $is_edit ? (int)get_post_meta($article_id,'_wmw_wiki_id',true) : $wiki_id;
|
||||
$a_order = $is_edit ? (int)get_post_meta($article_id,'_wmw_order',true) : 0;
|
||||
$a_status = $is_edit ? $article->post_status : 'publish';
|
||||
$a_cats = $is_edit ? wp_list_pluck((array)get_the_terms($article_id,'wmw_category'),'term_id') : array();
|
||||
$a_tags = $is_edit ? implode(', ', wp_list_pluck((array)get_the_terms($article_id,'wmw_tag'),'name')) : '';
|
||||
$all_cats = get_terms(array('taxonomy'=>'wmw_category','hide_empty'=>false));
|
||||
?>
|
||||
<div class="wrap wmw-admin-wrap">
|
||||
<div class="wmw-admin-header wmw-admin-header--small">
|
||||
<div class="wmw-admin-header__logo">
|
||||
<span class="wmw-admin-header__icon">📄</span>
|
||||
<div>
|
||||
<h1><?php echo esc_html($page_title); ?></h1>
|
||||
</div>
|
||||
</div>
|
||||
<a href="<?php echo admin_url('admin.php?page=wmw-articles' . ($a_wiki_id ? '&wiki_id='.$a_wiki_id : '')); ?>" class="button">← Zurück</a>
|
||||
</div>
|
||||
|
||||
<div class="wmw-form-layout">
|
||||
<div class="wmw-form-main">
|
||||
<div class="wmw-card">
|
||||
<div class="wmw-field">
|
||||
<label class="wmw-label">Artikeltitel <span class="required">*</span></label>
|
||||
<input type="text" id="wmw_a_title" name="wmw_a_title" class="large-text" value="<?php echo esc_attr($a_title); ?>" placeholder="Titel des Artikels…">
|
||||
</div>
|
||||
<div class="wmw-field">
|
||||
<label class="wmw-label">Inhalt</label>
|
||||
<?php
|
||||
wp_editor( $a_content, 'wmw_content', array(
|
||||
'textarea_name' => 'wmw_content',
|
||||
'media_buttons' => true,
|
||||
'textarea_rows' => 20,
|
||||
'tinymce' => true,
|
||||
) );
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wmw-form-sidebar">
|
||||
<div class="wmw-card">
|
||||
<h3 class="wmw-card__title">📁 Zuordnung</h3>
|
||||
<div class="wmw-field">
|
||||
<label class="wmw-label">Wiki <span class="required">*</span></label>
|
||||
<select id="wmw_a_wiki_id" name="wmw_a_wiki_id" class="widefat">
|
||||
<option value="">— Wiki wählen —</option>
|
||||
<?php foreach( $wikis as $w ): ?>
|
||||
<option value="<?php echo $w->ID; ?>" <?php selected($a_wiki_id,$w->ID); ?>>
|
||||
<?php echo wmw_get_wiki_icon($w->ID); ?> <?php echo esc_html($w->post_title); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="wmw-field">
|
||||
<label class="wmw-label">Kategorien</label>
|
||||
<div class="wmw-cat-list">
|
||||
<?php foreach( (array)$all_cats as $cat ): if(is_wp_error($cat)) continue; ?>
|
||||
<label class="wmw-checkbox">
|
||||
<input type="checkbox" name="wmw_categories[]" value="<?php echo $cat->term_id; ?>" <?php checked(in_array($cat->term_id, $a_cats)); ?>>
|
||||
<?php echo esc_html($cat->name); ?>
|
||||
</label>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<a href="<?php echo admin_url('admin.php?page=wmw-categories'); ?>" class="description">+ Neue Kategorie</a>
|
||||
</div>
|
||||
<div class="wmw-field">
|
||||
<label class="wmw-label">Tags <span class="description">(kommagetrennt)</span></label>
|
||||
<input type="text" id="wmw_a_tags" name="wmw_a_tags" class="widefat" value="<?php echo esc_attr($a_tags); ?>" placeholder="tag1, tag2, tag3">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wmw-card">
|
||||
<h3 class="wmw-card__title">⚙️ Optionen</h3>
|
||||
<div class="wmw-field">
|
||||
<label class="wmw-label">Status</label>
|
||||
<select id="wmw_a_status" name="wmw_a_status" class="widefat">
|
||||
<option value="publish" <?php selected($a_status,'publish'); ?>>✅ Veröffentlicht</option>
|
||||
<option value="draft" <?php selected($a_status,'draft'); ?>>📝 Entwurf</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="wmw-field">
|
||||
<label class="wmw-label">Reihenfolge</label>
|
||||
<input type="number" id="wmw_a_order" name="wmw_a_order" class="small-text" value="<?php echo $a_order; ?>" min="0">
|
||||
</div>
|
||||
<div class="wmw-field">
|
||||
<label class="wmw-label">Kurzbeschreibung</label>
|
||||
<textarea id="wmw_a_excerpt" name="wmw_a_excerpt" rows="3" class="widefat"><?php echo esc_textarea($a_excerpt); ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wmw-card">
|
||||
<button type="button" id="wmw-save-article" class="button button-primary button-large wmw-btn-full"
|
||||
data-id="<?php echo $article_id; ?>">
|
||||
<?php echo $is_edit ? '💾 Artikel speichern' : '🚀 Artikel erstellen'; ?>
|
||||
</button>
|
||||
<?php if ( $is_edit ) : ?>
|
||||
<a href="<?php echo get_permalink($article_id); ?>" target="_blank" class="button button-large wmw-btn-full wmw-mt-sm">
|
||||
🔗 Im Frontend ansehen
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
85
templates/admin/article-list.php
Normal file
85
templates/admin/article-list.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
|
||||
<div class="wrap wmw-admin-wrap">
|
||||
<div class="wmw-admin-header wmw-admin-header--small">
|
||||
<div class="wmw-admin-header__logo">
|
||||
<span class="wmw-admin-header__icon">📋</span>
|
||||
<div>
|
||||
<h1>Wiki-Artikel</h1>
|
||||
<p><?php echo count($articles); ?> Artikel</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wmw-admin-header__actions">
|
||||
<a href="<?php echo admin_url('admin.php?page=wmw-new-article' . ($wiki_filter ? '&wiki_id='.$wiki_filter : '')); ?>" class="button button-primary">➕ Neuer Artikel</a>
|
||||
<a href="<?php echo admin_url('admin.php?page=wp-multi-wiki'); ?>" class="button">← Dashboard</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Filter by Wiki -->
|
||||
<div class="wmw-filter-bar">
|
||||
<a href="<?php echo admin_url('admin.php?page=wmw-articles'); ?>" class="button <?php echo !$wiki_filter ? 'button-primary' : ''; ?>">Alle Wikis</a>
|
||||
<?php foreach( $wikis as $w ): ?>
|
||||
<a href="<?php echo admin_url('admin.php?page=wmw-articles&wiki_id='.$w->ID); ?>"
|
||||
class="button <?php echo $wiki_filter == $w->ID ? 'button-primary' : ''; ?>"
|
||||
style="<?php echo $wiki_filter == $w->ID ? '--wiki-color:'.wmw_get_wiki_color($w->ID) : ''; ?>">
|
||||
<?php echo wmw_get_wiki_icon($w->ID); ?> <?php echo esc_html($w->post_title); ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<?php if ( empty($articles) ): ?>
|
||||
<div class="wmw-empty-state">
|
||||
<div class="wmw-empty-state__icon">📄</div>
|
||||
<h2>Keine Artikel vorhanden</h2>
|
||||
<a href="<?php echo admin_url('admin.php?page=wmw-new-article' . ($wiki_filter ? '&wiki_id='.$wiki_filter : '')); ?>" class="button button-primary button-hero">Ersten Artikel erstellen</a>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="wmw-article-table-wrap">
|
||||
<input type="text" id="wmw-filter-articles" placeholder="🔍 Artikel filtern…" class="regular-text wmw-mb">
|
||||
<table class="wp-list-table widefat fixed striped wmw-article-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:40%">Titel</th>
|
||||
<th>Wiki</th>
|
||||
<th>Kategorien</th>
|
||||
<th>Status</th>
|
||||
<th>Reihenfolge</th>
|
||||
<th>Aktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach( $articles as $article ):
|
||||
$art_wiki = wmw_get_article_wiki($article->ID);
|
||||
$cats = get_the_terms($article->ID,'wmw_category');
|
||||
$cats_str = $cats && !is_wp_error($cats) ? implode(', ', wp_list_pluck($cats,'name')) : '—';
|
||||
$order = (int)get_post_meta($article->ID,'_wmw_order',true);
|
||||
?>
|
||||
<tr data-title="<?php echo esc_attr(strtolower($article->post_title)); ?>">
|
||||
<td>
|
||||
<strong><a href="<?php echo admin_url('admin.php?page=wmw-edit-article&id='.$article->ID); ?>"><?php echo esc_html($article->post_title); ?></a></strong>
|
||||
<div class="row-actions">
|
||||
<span><a href="<?php echo admin_url('admin.php?page=wmw-edit-article&id='.$article->ID); ?>">Bearbeiten</a></span> |
|
||||
<span><a href="<?php echo get_permalink($article->ID); ?>" target="_blank">Ansehen</a></span> |
|
||||
<span><a href="#" class="wmw-delete-article" data-id="<?php echo $article->ID; ?>" style="color:#a00">Löschen</a></span>
|
||||
</div>
|
||||
</td>
|
||||
<td><?php echo $art_wiki ? wmw_get_wiki_icon($art_wiki->ID).' '.esc_html($art_wiki->post_title) : '—'; ?></td>
|
||||
<td><?php echo esc_html($cats_str); ?></td>
|
||||
<td>
|
||||
<?php if($article->post_status==='publish'): ?>
|
||||
<span class="wmw-badge wmw-badge--green">Veröffentlicht</span>
|
||||
<?php else: ?>
|
||||
<span class="wmw-badge wmw-badge--gray">Entwurf</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><?php echo $order; ?></td>
|
||||
<td>
|
||||
<a href="<?php echo admin_url('admin.php?page=wmw-edit-article&id='.$article->ID); ?>" class="button button-small">✏️</a>
|
||||
<a href="#" class="button button-small wmw-delete-article" data-id="<?php echo $article->ID; ?>">🗑️</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
45
templates/admin/categories.php
Normal file
45
templates/admin/categories.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
$terms = get_terms(array('taxonomy'=>'wmw_category','hide_empty'=>false,'orderby'=>'name','order'=>'ASC'));
|
||||
?>
|
||||
<div class="wrap wmw-admin-wrap">
|
||||
<div class="wmw-admin-header wmw-admin-header--small">
|
||||
<div class="wmw-admin-header__logo">
|
||||
<span class="wmw-admin-header__icon">🏷️</span>
|
||||
<div><h1>Wiki-Kategorien</h1></div>
|
||||
</div>
|
||||
<a href="<?php echo admin_url('admin.php?page=wp-multi-wiki'); ?>" class="button">← Dashboard</a>
|
||||
</div>
|
||||
<div class="wmw-form-layout">
|
||||
<div class="wmw-form-main">
|
||||
<div class="wmw-card">
|
||||
<h3 class="wmw-card__title">Vorhandene Kategorien</h3>
|
||||
<?php if(empty($terms) || is_wp_error($terms)): ?>
|
||||
<p class="description">Noch keine Kategorien. Füge unten deine erste hinzu.</p>
|
||||
<?php else: ?>
|
||||
<table class="wp-list-table widefat fixed striped">
|
||||
<thead><tr><th>Name</th><th>Slug</th><th>Artikel</th><th>Aktionen</th></tr></thead>
|
||||
<tbody>
|
||||
<?php foreach($terms as $term): ?>
|
||||
<tr>
|
||||
<td><strong><?php echo esc_html($term->name); ?></strong></td>
|
||||
<td><?php echo esc_html($term->slug); ?></td>
|
||||
<td><?php echo $term->count; ?></td>
|
||||
<td>
|
||||
<a href="<?php echo admin_url('edit-tags.php?action=edit&taxonomy=wmw_category&tag_ID='.$term->term_id); ?>" class="button button-small">✏️ Bearbeiten</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wmw-form-sidebar">
|
||||
<div class="wmw-card">
|
||||
<h3 class="wmw-card__title">➕ Neue Kategorie</h3>
|
||||
<p><a href="<?php echo admin_url('edit-tags.php?taxonomy=wmw_category'); ?>" class="button button-primary wmw-btn-full">Kategorien in WordPress verwalten</a></p>
|
||||
<p class="description">Kategorien können über die Standard-WordPress-Taxonomieseite erstellt und bearbeitet werden.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
147
templates/admin/dashboard.php
Normal file
147
templates/admin/dashboard.php
Normal file
@@ -0,0 +1,147 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
|
||||
<div class="wrap wmw-admin-wrap">
|
||||
|
||||
<div class="wmw-admin-header">
|
||||
<div class="wmw-admin-header__logo">
|
||||
<span class="wmw-admin-header__icon">📚</span>
|
||||
<div>
|
||||
<h1>WP Multi Wiki</h1>
|
||||
<p>Verwalte alle deine Plugin-Wikis an einem Ort.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wmw-admin-header__actions">
|
||||
<a href="<?php echo admin_url('admin.php?page=wmw-new-wiki'); ?>" class="button button-primary wmw-btn-lg">
|
||||
➕ Neues Wiki erstellen
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Stats Bar -->
|
||||
<div class="wmw-stats-bar">
|
||||
<div class="wmw-stat">
|
||||
<span class="wmw-stat__num"><?php echo count($wikis); ?></span>
|
||||
<span class="wmw-stat__label">Wikis</span>
|
||||
</div>
|
||||
<div class="wmw-stat">
|
||||
<span class="wmw-stat__num"><?php echo $total_articles; ?></span>
|
||||
<span class="wmw-stat__label">Artikel gesamt</span>
|
||||
</div>
|
||||
<div class="wmw-stat">
|
||||
<span class="wmw-stat__num"><?php echo wp_count_terms('wmw_category'); ?></span>
|
||||
<span class="wmw-stat__label">Kategorien</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Quick Search -->
|
||||
<div class="wmw-admin-search-bar">
|
||||
<input type="text" id="wmw-filter-wikis" placeholder="🔍 Wikis filtern…" class="regular-text">
|
||||
</div>
|
||||
|
||||
<?php if ( empty( $wikis ) ) : ?>
|
||||
<div class="wmw-empty-state">
|
||||
<div class="wmw-empty-state__icon">📖</div>
|
||||
<h2>Noch keine Wikis vorhanden</h2>
|
||||
<p>Erstelle dein erstes Wiki für dein Plugin!</p>
|
||||
<a href="<?php echo admin_url('admin.php?page=wmw-new-wiki'); ?>" class="button button-primary button-hero">
|
||||
Erstes Wiki erstellen
|
||||
</a>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
|
||||
<div class="wmw-wiki-grid" id="wmw-wiki-grid">
|
||||
<?php foreach ( $wikis as $wiki ) :
|
||||
$wiki_id = $wiki->ID;
|
||||
$articles = wmw_get_articles( $wiki_id );
|
||||
$article_count = count( $articles );
|
||||
$icon = wmw_get_wiki_icon( $wiki_id );
|
||||
$color = wmw_get_wiki_color( $wiki_id );
|
||||
$version = get_post_meta( $wiki_id, '_wmw_version', true ) ?: '1.0.0';
|
||||
$edit_url = admin_url( 'admin.php?page=wmw-edit-wiki&id=' . $wiki_id );
|
||||
$new_art_url = admin_url( 'admin.php?page=wmw-new-article&wiki_id=' . $wiki_id );
|
||||
$articles_url = admin_url( 'admin.php?page=wmw-articles&wiki_id=' . $wiki_id );
|
||||
$view_url = get_permalink( $wiki_id );
|
||||
?>
|
||||
<div class="wmw-wiki-card" data-title="<?php echo esc_attr( strtolower( $wiki->post_title ) ); ?>" style="--wiki-color: <?php echo esc_attr($color); ?>">
|
||||
<div class="wmw-wiki-card__header">
|
||||
<span class="wmw-wiki-card__icon"><?php echo $icon; ?></span>
|
||||
<div class="wmw-wiki-card__meta">
|
||||
<span class="wmw-wiki-card__version">v<?php echo esc_html($version); ?></span>
|
||||
<span class="wmw-wiki-card__status <?php echo $wiki->post_status === 'publish' ? 'is-live' : 'is-draft'; ?>">
|
||||
<?php echo $wiki->post_status === 'publish' ? '● Live' : '○ Entwurf'; ?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<h3 class="wmw-wiki-card__title"><?php echo esc_html( $wiki->post_title ); ?></h3>
|
||||
<?php if ( $wiki->post_excerpt ) : ?>
|
||||
<p class="wmw-wiki-card__desc"><?php echo esc_html( wp_trim_words( $wiki->post_excerpt, 12 ) ); ?></p>
|
||||
<?php endif; ?>
|
||||
<div class="wmw-wiki-card__stats">
|
||||
<span>📄 <?php echo $article_count; ?> Artikel</span>
|
||||
</div>
|
||||
<div class="wmw-wiki-card__actions">
|
||||
<a href="<?php echo esc_url($edit_url); ?>" class="button button-small">✏️ Bearbeiten</a>
|
||||
<a href="<?php echo esc_url($articles_url); ?>" class="button button-small">📋 Artikel</a>
|
||||
<a href="<?php echo esc_url($new_art_url); ?>" class="button button-small button-primary">➕ Artikel</a>
|
||||
<a href="<?php echo esc_url($view_url); ?>" target="_blank" class="button button-small">🔗 Ansehen</a>
|
||||
<button class="button button-small wmw-delete-wiki" data-id="<?php echo $wiki_id; ?>" data-title="<?php echo esc_attr($wiki->post_title); ?>">🗑️</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Shortcode Reference -->
|
||||
<div class="wmw-shortcode-ref">
|
||||
<h3>📋 Shortcode-Referenz</h3>
|
||||
<div class="wmw-shortcode-grid">
|
||||
<div class="wmw-shortcode-item">
|
||||
<code>[wmw_wiki_list]</code>
|
||||
<span>Alle Wikis als Karten anzeigen</span>
|
||||
</div>
|
||||
<div class="wmw-shortcode-item">
|
||||
<code>[wmw_wiki id="1"]</code>
|
||||
<span>Ein Wiki mit allen Artikeln</span>
|
||||
</div>
|
||||
<div class="wmw-shortcode-item">
|
||||
<code>[wmw_wiki slug="mein-plugin"]</code>
|
||||
<span>Wiki per Slug einbinden</span>
|
||||
</div>
|
||||
<div class="wmw-shortcode-item">
|
||||
<code>[wmw_search wiki_id="1"]</code>
|
||||
<span>Suchfeld für ein Wiki</span>
|
||||
</div>
|
||||
<div class="wmw-shortcode-item">
|
||||
<code>[wmw_article id="5"]</code>
|
||||
<span>Einzelnen Artikel einbetten</span>
|
||||
</div>
|
||||
<div class="wmw-shortcode-item">
|
||||
<code>[wmw_breadcrumb]</code>
|
||||
<span>Breadcrumb-Navigation</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Suchindex -->
|
||||
<div class="wmw-shortcode-ref" style="margin-top:16px">
|
||||
<h3>🔍 Suchindex</h3>
|
||||
<p class="description">Falls die Suche keine Ergebnisse liefert (z.B. nach einem Gitea-Import), den Index neu aufbauen.</p>
|
||||
<button id="wmw-reindex-btn" class="button button-secondary">🔄 Suchindex neu aufbauen</button>
|
||||
<span id="wmw-reindex-result" style="margin-left:12px;font-weight:600"></span>
|
||||
</div>
|
||||
<script>
|
||||
jQuery(function($){
|
||||
$('#wmw-reindex-btn').on('click', function(){
|
||||
var $btn = $(this);
|
||||
var $res = $('#wmw-reindex-result');
|
||||
$btn.prop('disabled', true).text('⏳ Läuft…');
|
||||
$.post(wmwAdmin.ajaxUrl, { action: 'wmw_reindex', nonce: wmwAdmin.nonce }, function(res){
|
||||
$btn.prop('disabled', false).text('🔄 Suchindex neu aufbauen');
|
||||
if(res.success){ $res.css('color','#2e7d32').text('✅ ' + res.data.message); }
|
||||
else { $res.css('color','#c62828').text('❌ Fehler'); }
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
254
templates/admin/gitea-importer.php
Normal file
254
templates/admin/gitea-importer.php
Normal file
@@ -0,0 +1,254 @@
|
||||
<?php
|
||||
/**
|
||||
* Admin-Seite: Gitea Wiki Importer
|
||||
*/
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
$wikis = wmw_get_wikis();
|
||||
$result = null;
|
||||
$preview = null;
|
||||
|
||||
// ── Handle Preview ────────────────────────────────────────────────────────────
|
||||
if ( isset( $_POST['wmw_gitea_preview'] ) && wp_verify_nonce( $_POST['wmw_gitea_nonce'] ?? '', 'wmw_gitea_import' ) && current_user_can( 'manage_options' ) ) {
|
||||
|
||||
$gitea_url = esc_url_raw( $_POST['gitea_url'] ?? '' );
|
||||
$owner = sanitize_text_field( $_POST['gitea_owner'] ?? '' );
|
||||
$repo = sanitize_text_field( $_POST['gitea_repo'] ?? '' );
|
||||
$token = sanitize_text_field( $_POST['gitea_token'] ?? '' );
|
||||
|
||||
if ( $gitea_url && $owner && $repo ) {
|
||||
$importer = new WMW_Gitea_Importer( $gitea_url, $owner, $repo, $token );
|
||||
$preview = $importer->list_pages();
|
||||
}
|
||||
}
|
||||
|
||||
// ── Handle Import ─────────────────────────────────────────────────────────────
|
||||
if ( isset( $_POST['wmw_gitea_import'] ) && wp_verify_nonce( $_POST['wmw_gitea_nonce'] ?? '', 'wmw_gitea_import' ) && current_user_can( 'manage_options' ) ) {
|
||||
|
||||
$gitea_url = esc_url_raw( $_POST['gitea_url'] ?? '' );
|
||||
$owner = sanitize_text_field( $_POST['gitea_owner'] ?? '' );
|
||||
$repo = sanitize_text_field( $_POST['gitea_repo'] ?? '' );
|
||||
$token = sanitize_text_field( $_POST['gitea_token'] ?? '' );
|
||||
$wiki_id = absint( $_POST['wmw_wiki_id'] ?? 0 );
|
||||
$skip_pages = array_map( 'sanitize_text_field', array_filter( explode( "\n", str_replace( "\r", '', $_POST['skip_pages'] ?? '' ) ) ) );
|
||||
$update_exist = isset( $_POST['update_existing'] );
|
||||
|
||||
if ( $gitea_url && $owner && $repo && $wiki_id ) {
|
||||
$importer = new WMW_Gitea_Importer( $gitea_url, $owner, $repo, $token );
|
||||
$result = $importer->import_all( $wiki_id, $skip_pages, $update_exist );
|
||||
} else {
|
||||
$result = array( 'errors' => array( 'Bitte alle Pflichtfelder ausfüllen.' ) );
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="wrap wmw-admin-wrap">
|
||||
|
||||
<div class="wmw-admin-header">
|
||||
<div class="wmw-admin-header__logo">
|
||||
<span class="wmw-admin-header__icon">🐙</span>
|
||||
<div>
|
||||
<h1>Gitea Wiki Importer</h1>
|
||||
<p>Importiere Wiki-Seiten direkt aus deiner Gitea-Instanz in WP Multi Wiki.</p>
|
||||
</div>
|
||||
</div>
|
||||
<a href="<?php echo admin_url('admin.php?page=wp-multi-wiki'); ?>" class="button">← Dashboard</a>
|
||||
</div>
|
||||
|
||||
<?php if ( $result !== null ) : ?>
|
||||
<div class="wmw-import-result <?php echo empty($result['errors']) ? 'wmw-import-result--success' : 'wmw-import-result--warn'; ?>">
|
||||
<h3>📊 Import-Ergebnis</h3>
|
||||
<div class="wmw-import-stats">
|
||||
<div class="wmw-import-stat">
|
||||
<span class="wmw-import-stat__num"><?php echo $result['imported']; ?></span>
|
||||
<span>Neu importiert</span>
|
||||
</div>
|
||||
<div class="wmw-import-stat">
|
||||
<span class="wmw-import-stat__num"><?php echo $result['updated']; ?></span>
|
||||
<span>Aktualisiert</span>
|
||||
</div>
|
||||
<div class="wmw-import-stat">
|
||||
<span class="wmw-import-stat__num"><?php echo $result['skipped']; ?></span>
|
||||
<span>Übersprungen</span>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ( ! empty( $result['errors'] ) ) : ?>
|
||||
<div class="wmw-import-errors">
|
||||
<strong>⚠️ Fehler:</strong>
|
||||
<ul><?php foreach( $result['errors'] as $e ): ?><li><?php echo esc_html($e); ?></li><?php endforeach; ?></ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ( isset($_POST['wmw_wiki_id']) ) : ?>
|
||||
<a href="<?php echo admin_url('admin.php?page=wmw-articles&wiki_id='.absint($_POST['wmw_wiki_id'])); ?>" class="button button-primary" style="margin-top:12px">
|
||||
📋 Importierte Artikel ansehen
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="wmw-form-layout">
|
||||
<div class="wmw-form-main">
|
||||
|
||||
<form method="post" id="wmw-gitea-form">
|
||||
<?php wp_nonce_field( 'wmw_gitea_import', 'wmw_gitea_nonce' ); ?>
|
||||
|
||||
<div class="wmw-card">
|
||||
<h3 class="wmw-card__title">🔗 Gitea-Quelle</h3>
|
||||
|
||||
<div class="wmw-field">
|
||||
<label class="wmw-label">Gitea-Server URL <span class="required">*</span></label>
|
||||
<input type="url" name="gitea_url" class="large-text" required
|
||||
value="<?php echo esc_attr( $_POST['gitea_url'] ?? 'https://git.viper.ipv64.net' ); ?>"
|
||||
placeholder="https://git.viper.ipv64.net">
|
||||
<p class="description">Nur die Basis-URL deiner Gitea-Instanz (ohne /api oder /wiki).</p>
|
||||
</div>
|
||||
|
||||
<div style="display:grid;grid-template-columns:1fr 1fr;gap:16px">
|
||||
<div class="wmw-field">
|
||||
<label class="wmw-label">Owner / Nutzer <span class="required">*</span></label>
|
||||
<input type="text" name="gitea_owner" class="regular-text" required
|
||||
value="<?php echo esc_attr( $_POST['gitea_owner'] ?? 'M_Viper' ); ?>"
|
||||
placeholder="M_Viper">
|
||||
</div>
|
||||
<div class="wmw-field">
|
||||
<label class="wmw-label">Repository <span class="required">*</span></label>
|
||||
<input type="text" name="gitea_repo" class="regular-text" required
|
||||
value="<?php echo esc_attr( $_POST['gitea_repo'] ?? 'NexusLobby' ); ?>"
|
||||
placeholder="NexusLobby">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wmw-field">
|
||||
<label class="wmw-label">Access Token <span class="description">(nur für private Repos nötig)</span></label>
|
||||
<input type="password" name="gitea_token" class="regular-text"
|
||||
value="<?php echo esc_attr( $_POST['gitea_token'] ?? '' ); ?>"
|
||||
placeholder="gitea_token_…">
|
||||
<p class="description">Token unter Gitea → Einstellungen → Anwendungen → Access Token erstellen.</p>
|
||||
</div>
|
||||
|
||||
<button type="submit" name="wmw_gitea_preview" class="button button-secondary">
|
||||
🔍 Seiten vorab laden
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<?php if ( $preview !== null ) : ?>
|
||||
<div class="wmw-card">
|
||||
<h3 class="wmw-card__title">📋 Gefundene Wiki-Seiten</h3>
|
||||
<?php if ( is_wp_error( $preview ) ) : ?>
|
||||
<div class="notice notice-error inline"><p>❌ <?php echo esc_html( $preview->get_error_message() ); ?></p></div>
|
||||
<?php elseif ( empty( $preview ) ) : ?>
|
||||
<p class="description">Keine Seiten gefunden.</p>
|
||||
<?php else : ?>
|
||||
<div class="wmw-preview-grid">
|
||||
<?php foreach( $preview as $p ): ?>
|
||||
<div class="wmw-preview-item">
|
||||
<span class="wmw-preview-item__icon">📄</span>
|
||||
<span class="wmw-preview-item__title"><?php echo esc_html($p['title']); ?></span>
|
||||
<span class="wmw-preview-item__date"><?php echo esc_html(substr($p['last_updated'],0,10)); ?></span>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<p class="description" style="margin-top:10px">✅ <?php echo count($preview); ?> Seiten bereit zum Import.</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="wmw-card">
|
||||
<h3 class="wmw-card__title">🎯 Import-Ziel</h3>
|
||||
|
||||
<div class="wmw-field">
|
||||
<label class="wmw-label">Ziel-Wiki <span class="required">*</span></label>
|
||||
<select name="wmw_wiki_id" class="regular-text" required>
|
||||
<option value="">— Wiki wählen —</option>
|
||||
<?php foreach( $wikis as $w ): ?>
|
||||
<option value="<?php echo $w->ID; ?>" <?php selected( absint($_POST['wmw_wiki_id'] ?? 0), $w->ID ); ?>>
|
||||
<?php echo wmw_get_wiki_icon($w->ID); ?> <?php echo esc_html($w->post_title); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<p class="description">Alle Seiten werden als Artikel in diesem Wiki angelegt.</p>
|
||||
</div>
|
||||
|
||||
<div class="wmw-field">
|
||||
<label class="wmw-label">Seiten überspringen <span class="description">(eine pro Zeile)</span></label>
|
||||
<textarea name="skip_pages" rows="5" class="large-text"><?php
|
||||
echo esc_textarea( $_POST['skip_pages'] ?? "Home\n_Sidebar" );
|
||||
?></textarea>
|
||||
<p class="description">Diese Seiten werden nicht importiert (z.B. Home, _Sidebar).</p>
|
||||
</div>
|
||||
|
||||
<div class="wmw-field">
|
||||
<label class="wmw-checkbox">
|
||||
<input type="checkbox" name="update_existing" value="1" <?php checked( isset($_POST['update_existing']) ); ?>>
|
||||
Bereits vorhandene Artikel aktualisieren
|
||||
</label>
|
||||
<p class="description" style="margin-left:22px">Wenn deaktiviert, werden bestehende Artikel übersprungen.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wmw-card">
|
||||
<button type="submit" name="wmw_gitea_import" class="button button-primary button-large" style="width:100%">
|
||||
🚀 Wiki jetzt importieren
|
||||
</button>
|
||||
<p class="description" style="text-align:center;margin-top:8px">
|
||||
Der Import kann je nach Wiki-Größe einige Sekunden dauern.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="wmw-form-sidebar">
|
||||
<div class="wmw-card">
|
||||
<h3 class="wmw-card__title">ℹ️ Wie funktioniert's?</h3>
|
||||
<ol style="margin:0;padding-left:18px;font-size:13px;line-height:2">
|
||||
<li>Gitea-URL, Owner & Repo eingeben</li>
|
||||
<li>Auf <strong>Seiten vorab laden</strong> klicken</li>
|
||||
<li>Ziel-Wiki auswählen</li>
|
||||
<li>Seiten auswählen die übersprungen werden sollen</li>
|
||||
<li><strong>Importieren</strong> klicken</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="wmw-card">
|
||||
<h3 class="wmw-card__title">🔐 Private Repos</h3>
|
||||
<p style="font-size:13px">Für private Repositories brauchst du einen <strong>Access Token</strong>:</p>
|
||||
<ol style="margin:0;padding-left:18px;font-size:13px;line-height:2">
|
||||
<li>In Gitea anmelden</li>
|
||||
<li>Einstellungen → Anwendungen</li>
|
||||
<li>„Token generieren" mit <code>read:wiki</code> Scope</li>
|
||||
<li>Token oben eintragen</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="wmw-card">
|
||||
<h3 class="wmw-card__title">📝 Markdown-Konvertierung</h3>
|
||||
<p style="font-size:13px">Folgende Elemente werden automatisch konvertiert:</p>
|
||||
<ul style="margin:0;padding-left:18px;font-size:13px;line-height:1.8">
|
||||
<li>Überschriften H1–H6</li>
|
||||
<li>Fett, Kursiv, Durchgestrichen</li>
|
||||
<li>Code-Blöcke (mit Syntax-Highlighting)</li>
|
||||
<li>Tabellen</li>
|
||||
<li>Links & Bilder</li>
|
||||
<li>Blockquotes</li>
|
||||
<li>Aufzählungslisten</li>
|
||||
<li>Gitea-interne <code>[[Links]]</code></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.wmw-preview-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:8px; }
|
||||
.wmw-preview-item { display:flex; align-items:center; gap:8px; padding:8px 10px; background:var(--wmw-admin-bg); border-radius:6px; border:1px solid var(--wmw-admin-border); }
|
||||
.wmw-preview-item__icon { font-size:16px; }
|
||||
.wmw-preview-item__title { font-size:13px; font-weight:600; flex:1; }
|
||||
.wmw-preview-item__date { font-size:11px; color:#888; }
|
||||
.wmw-import-result { padding:20px 24px; border-radius:8px; margin-bottom:20px; }
|
||||
.wmw-import-result--success { background:#e8f5e9; border:1px solid #a5d6a7; }
|
||||
.wmw-import-result--warn { background:#fff8e1; border:1px solid #ffe082; }
|
||||
.wmw-import-result h3 { margin:0 0 12px; }
|
||||
.wmw-import-stats { display:flex; gap:16px; margin-bottom:12px; flex-wrap:wrap; }
|
||||
.wmw-import-stat { text-align:center; background:#fff; padding:10px 20px; border-radius:6px; border:1px solid rgba(0,0,0,.08); }
|
||||
.wmw-import-stat__num { display:block; font-size:24px; font-weight:700; color:#2e7d32; }
|
||||
.wmw-import-errors { background:#fff3e0; border:1px solid #ffcc80; border-radius:6px; padding:10px 14px; margin-top:10px; }
|
||||
.wmw-import-errors ul { margin:6px 0 0 18px; font-size:13px; }
|
||||
</style>
|
||||
67
templates/admin/settings.php
Normal file
67
templates/admin/settings.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
|
||||
<div class="wrap wmw-admin-wrap">
|
||||
<div class="wmw-admin-header wmw-admin-header--small">
|
||||
<div class="wmw-admin-header__logo">
|
||||
<span class="wmw-admin-header__icon">⚙️</span>
|
||||
<div><h1>WP Multi Wiki – Einstellungen</h1></div>
|
||||
</div>
|
||||
</div>
|
||||
<form method="post" action="">
|
||||
<?php wp_nonce_field('wmw_save_settings','wmw_settings_nonce'); ?>
|
||||
<div class="wmw-form-layout">
|
||||
<div class="wmw-form-main">
|
||||
<div class="wmw-card">
|
||||
<h3 class="wmw-card__title">🖥️ Darstellung</h3>
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th>Inhaltsverzeichnis (TOC)</th>
|
||||
<td><label><input type="checkbox" name="show_toc" value="1" <?php checked($settings['show_toc']??1,1); ?>> Automatisches TOC aus Überschriften generieren</label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Breadcrumbs</th>
|
||||
<td><label><input type="checkbox" name="show_breadcrumbs" value="1" <?php checked($settings['show_breadcrumbs']??1,1); ?>> Breadcrumb-Navigation anzeigen</label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Verwandte Artikel</th>
|
||||
<td><label><input type="checkbox" name="show_related" value="1" <?php checked($settings['show_related']??1,1); ?>> Ähnliche Artikel am Ende anzeigen</label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Suchfeld</th>
|
||||
<td><label><input type="checkbox" name="show_search" value="1" <?php checked($settings['show_search']??1,1); ?>> Suchfeld im Wiki anzeigen</label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Sidebar-Position</th>
|
||||
<td>
|
||||
<select name="sidebar_position">
|
||||
<option value="left" <?php selected($settings['sidebar_position']??'left','left'); ?>>Links</option>
|
||||
<option value="right" <?php selected($settings['sidebar_position']??'left','right'); ?>>Rechts</option>
|
||||
<option value="none" <?php selected($settings['sidebar_position']??'left','none'); ?>>Keine Sidebar</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Artikel pro Seite</th>
|
||||
<td><input type="number" name="articles_per_page" value="<?php echo esc_attr($settings['articles_per_page']??20); ?>" class="small-text" min="5" max="100"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="wmw-card">
|
||||
<h3 class="wmw-card__title">🎨 Custom CSS</h3>
|
||||
<p class="description">Eigenes CSS für das Wiki-Frontend. Hier kannst du das Design anpassen.</p>
|
||||
<textarea name="custom_css" rows="10" class="large-text code"><?php echo esc_textarea($settings['custom_css']??''); ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wmw-form-sidebar">
|
||||
<div class="wmw-card">
|
||||
<h3 class="wmw-card__title">💾 Speichern</h3>
|
||||
<?php submit_button('Einstellungen speichern','primary','submit',false); ?>
|
||||
</div>
|
||||
<div class="wmw-card">
|
||||
<h3 class="wmw-card__title">ℹ️ Plugin-Info</h3>
|
||||
<p><strong>WP Multi Wiki</strong><br>Version <?php echo WMW_VERSION; ?></p>
|
||||
<p>Autor: <strong>M_Viper</strong></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
102
templates/admin/wiki-form.php
Normal file
102
templates/admin/wiki-form.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
$is_edit = isset( $wiki ) && $wiki;
|
||||
$page_title = $is_edit ? 'Wiki bearbeiten' : 'Neues Wiki erstellen';
|
||||
$wiki_id = $is_edit ? $wiki->ID : 0;
|
||||
$wiki_title = $is_edit ? $wiki->post_title : '';
|
||||
$wiki_desc = $is_edit ? $wiki->post_content : '';
|
||||
$wiki_excerpt= $is_edit ? $wiki->post_excerpt : '';
|
||||
$wiki_icon = $is_edit ? get_post_meta($wiki_id,'_wmw_icon',true) : '📖';
|
||||
$wiki_color = $is_edit ? get_post_meta($wiki_id,'_wmw_color',true) : '#2271b1';
|
||||
$wiki_ver = $is_edit ? get_post_meta($wiki_id,'_wmw_version',true) : '1.0.0';
|
||||
$wiki_status = $is_edit ? $wiki->post_status : 'publish';
|
||||
?>
|
||||
<div class="wrap wmw-admin-wrap">
|
||||
<div class="wmw-admin-header wmw-admin-header--small">
|
||||
<div class="wmw-admin-header__logo">
|
||||
<span class="wmw-admin-header__icon">📝</span>
|
||||
<div>
|
||||
<h1><?php echo esc_html($page_title); ?></h1>
|
||||
<p><?php echo $is_edit ? 'Passe dein Wiki an.' : 'Lege ein neues Wiki für dein Plugin an.'; ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<a href="<?php echo admin_url('admin.php?page=wp-multi-wiki'); ?>" class="button">← Zurück</a>
|
||||
</div>
|
||||
|
||||
<div class="wmw-form-layout">
|
||||
<div class="wmw-form-main">
|
||||
<div class="wmw-card">
|
||||
<div class="wmw-field">
|
||||
<label for="wmw_title" class="wmw-label">Wiki-Name <span class="required">*</span></label>
|
||||
<input type="text" id="wmw_title" name="wmw_title" class="large-text" value="<?php echo esc_attr($wiki_title); ?>" placeholder="z.B. My Awesome Plugin">
|
||||
</div>
|
||||
<div class="wmw-field">
|
||||
<label for="wmw_excerpt" class="wmw-label">Kurzbeschreibung</label>
|
||||
<input type="text" id="wmw_excerpt" name="wmw_excerpt" class="large-text" value="<?php echo esc_attr($wiki_excerpt); ?>" placeholder="Kurze Beschreibung des Plugins…">
|
||||
</div>
|
||||
<div class="wmw-field">
|
||||
<label class="wmw-label">Beschreibung / Intro-Text</label>
|
||||
<?php
|
||||
wp_editor( $wiki_desc, 'wmw_description', array(
|
||||
'textarea_name' => 'wmw_description',
|
||||
'media_buttons' => false,
|
||||
'textarea_rows' => 8,
|
||||
'tinymce' => true,
|
||||
) );
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wmw-form-sidebar">
|
||||
<div class="wmw-card">
|
||||
<h3 class="wmw-card__title">🎨 Erscheinungsbild</h3>
|
||||
<div class="wmw-field">
|
||||
<label class="wmw-label">Icon (Emoji)</label>
|
||||
<input type="text" id="wmw_icon" name="wmw_icon" value="<?php echo esc_attr($wiki_icon); ?>" style="font-size:24px;width:80px;text-align:center;">
|
||||
<p class="description">Ein Emoji-Icon für dein Wiki</p>
|
||||
<div class="wmw-emoji-picker">
|
||||
<?php $emojis = ['📖','📚','🔌','⚙️','🛠️','💡','🚀','🔧','📦','🎯','🔑','📊','🖥️','💻','📝','🌐','🔒','⚡','🎮','📱'];
|
||||
foreach($emojis as $e): ?>
|
||||
<button type="button" class="wmw-emoji-btn" data-emoji="<?php echo $e; ?>"><?php echo $e; ?></button>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wmw-field">
|
||||
<label class="wmw-label">Akzentfarbe</label>
|
||||
<input type="text" id="wmw_color" name="wmw_color" value="<?php echo esc_attr($wiki_color); ?>" class="wmw-color-picker">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wmw-card">
|
||||
<h3 class="wmw-card__title">⚙️ Plugin-Info</h3>
|
||||
<div class="wmw-field">
|
||||
<label class="wmw-label">Plugin-Version</label>
|
||||
<input type="text" name="wmw_version" value="<?php echo esc_attr($wiki_ver); ?>" class="regular-text" placeholder="1.0.0">
|
||||
</div>
|
||||
<div class="wmw-field">
|
||||
<label class="wmw-label">Status</label>
|
||||
<select name="wmw_status" class="regular-text">
|
||||
<option value="publish" <?php selected($wiki_status,'publish'); ?>>✅ Veröffentlicht</option>
|
||||
<option value="draft" <?php selected($wiki_status,'draft'); ?>>📝 Entwurf</option>
|
||||
<option value="private" <?php selected($wiki_status,'private'); ?>>🔒 Privat</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wmw-card">
|
||||
<button type="button" id="wmw-save-wiki" class="button button-primary button-large wmw-btn-full"
|
||||
data-id="<?php echo $wiki_id; ?>">
|
||||
<?php echo $is_edit ? '💾 Wiki speichern' : '🚀 Wiki erstellen'; ?>
|
||||
</button>
|
||||
<?php if ( $is_edit ) : ?>
|
||||
<a href="<?php echo get_permalink($wiki_id); ?>" target="_blank" class="button button-large wmw-btn-full wmw-mt-sm">
|
||||
🔗 Im Frontend ansehen
|
||||
</a>
|
||||
<a href="<?php echo admin_url('admin.php?page=wmw-new-article&wiki_id='.$wiki_id); ?>" class="button wmw-btn-full wmw-mt-sm">
|
||||
➕ Artikel hinzufügen
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
15
templates/breadcrumb.php
Normal file
15
templates/breadcrumb.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
|
||||
<nav class="wmw-breadcrumb" aria-label="Breadcrumb">
|
||||
<ol class="wmw-breadcrumb__list">
|
||||
<?php $last = count($items) - 1; foreach ($items as $i => $item): ?>
|
||||
<li class="wmw-breadcrumb__item <?php echo $i === $last ? 'is-current' : ''; ?>">
|
||||
<?php if ($item['url'] && $i !== $last): ?>
|
||||
<a href="<?php echo esc_url($item['url']); ?>" class="wmw-breadcrumb__link"><?php echo esc_html($item['label']); ?></a>
|
||||
<span class="wmw-breadcrumb__sep" aria-hidden="true">›</span>
|
||||
<?php else: ?>
|
||||
<span><?php echo esc_html($item['label']); ?></span>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
</nav>
|
||||
16
templates/search-box.php
Normal file
16
templates/search-box.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
|
||||
<div class="wmw-search" data-wiki-id="<?php echo absint($wiki_id); ?>">
|
||||
<div class="wmw-search__wrap">
|
||||
<input
|
||||
type="text"
|
||||
class="wmw-search__input"
|
||||
placeholder="<?php echo esc_attr($placeholder); ?>"
|
||||
autocomplete="off"
|
||||
aria-label="<?php echo esc_attr($placeholder); ?>"
|
||||
>
|
||||
<span class="wmw-search__icon">🔍</span>
|
||||
</div>
|
||||
<div class="wmw-search__results" hidden>
|
||||
<div class="wmw-search__results-inner"></div>
|
||||
</div>
|
||||
</div>
|
||||
56
templates/sidebar.php
Normal file
56
templates/sidebar.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
global $post;
|
||||
$current_id = $post ? $post->ID : 0;
|
||||
?>
|
||||
<div class="wmw-sidebar-nav">
|
||||
<div class="wmw-sidebar-nav__wiki">
|
||||
<a href="<?php echo get_permalink($wiki->ID); ?>" class="wmw-sidebar-nav__wiki-link">
|
||||
<span class="wmw-sidebar-nav__wiki-icon"><?php echo wmw_get_wiki_icon($wiki->ID); ?></span>
|
||||
<span class="wmw-sidebar-nav__wiki-name"><?php echo esc_html($wiki->post_title); ?></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// Group articles by category
|
||||
$grouped = array();
|
||||
$cat_names = array();
|
||||
|
||||
foreach ($articles as $art) {
|
||||
$cats = get_the_terms($art->ID, 'wmw_category');
|
||||
if ($cats && !is_wp_error($cats)) {
|
||||
foreach ($cats as $cat) {
|
||||
$grouped[$cat->term_id][] = $art;
|
||||
$cat_names[$cat->term_id] = $cat->name;
|
||||
}
|
||||
} else {
|
||||
$grouped['_none'][] = $art;
|
||||
}
|
||||
}
|
||||
|
||||
// Sort: named categories first, then uncategorized
|
||||
ksort($grouped);
|
||||
|
||||
foreach ($grouped as $cat_id => $cat_arts):
|
||||
$cat_label = $cat_id === '_none' ? 'Allgemein' : ($cat_names[$cat_id] ?? 'Sonstige');
|
||||
|
||||
// Sort by order
|
||||
usort($cat_arts, function($a,$b){
|
||||
$oa = (int)get_post_meta($a->ID,'_wmw_order',true);
|
||||
$ob = (int)get_post_meta($b->ID,'_wmw_order',true);
|
||||
return $oa - $ob;
|
||||
});
|
||||
?>
|
||||
<div class="wmw-sidebar-nav__group">
|
||||
<div class="wmw-sidebar-nav__group-label"><?php echo esc_html($cat_label); ?></div>
|
||||
<ul class="wmw-sidebar-nav__list">
|
||||
<?php foreach ($cat_arts as $art): ?>
|
||||
<li class="wmw-sidebar-nav__item <?php echo ($art->ID === $current_id) ? 'is-active' : ''; ?>">
|
||||
<a href="<?php echo get_permalink($art->ID); ?>" class="wmw-sidebar-nav__link">
|
||||
<?php echo esc_html($art->post_title); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
132
templates/single-wmw-article.php
Normal file
132
templates/single-wmw-article.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
get_header();
|
||||
global $post;
|
||||
$settings = get_option('wmw_settings', array());
|
||||
$article = $post;
|
||||
$wiki = wmw_get_article_wiki($article->ID);
|
||||
$side_pos = $settings['sidebar_position'] ?? 'left';
|
||||
?>
|
||||
<div class="wmw-page wmw-article-page">
|
||||
<?php if ($settings['show_breadcrumbs'] ?? 1): ?>
|
||||
<?php WMW_Frontend::render_breadcrumb($article); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="wmw-layout wmw-layout--<?php echo esc_attr($side_pos); ?>">
|
||||
|
||||
<?php if ($side_pos !== 'none' && $wiki) : ?>
|
||||
<aside class="wmw-sidebar">
|
||||
<?php if ($settings['show_search'] ?? 1): ?>
|
||||
<?php WMW_Frontend::render_search_box($wiki->ID); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo WMW_Frontend::get_wiki_sidebar($wiki); ?>
|
||||
</aside>
|
||||
<?php endif; ?>
|
||||
|
||||
<main class="wmw-main">
|
||||
<article class="wmw-article">
|
||||
<header class="wmw-article__header">
|
||||
<?php if ($wiki): ?>
|
||||
<a href="<?php echo get_permalink($wiki->ID); ?>" class="wmw-article__wiki-link">
|
||||
<span><?php echo wmw_get_wiki_icon($wiki->ID); ?></span>
|
||||
<?php echo esc_html($wiki->post_title); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<h1 class="wmw-article__title"><?php echo esc_html($article->post_title); ?></h1>
|
||||
<div class="wmw-article__meta">
|
||||
<?php $cats = get_the_terms($article->ID, 'wmw_category');
|
||||
if ($cats && !is_wp_error($cats)):
|
||||
foreach($cats as $cat): ?>
|
||||
<a href="<?php echo get_term_link($cat); ?>" class="wmw-tag wmw-tag--cat"><?php echo esc_html($cat->name); ?></a>
|
||||
<?php endforeach;
|
||||
endif; ?>
|
||||
<?php $tags = get_the_terms($article->ID, 'wmw_tag');
|
||||
if ($tags && !is_wp_error($tags)):
|
||||
foreach($tags as $tag): ?>
|
||||
<a href="<?php echo get_term_link($tag); ?>" class="wmw-tag"><?php echo esc_html($tag->name); ?></a>
|
||||
<?php endforeach;
|
||||
endif; ?>
|
||||
<span class="wmw-article__updated">Aktualisiert: <?php echo get_the_modified_date('d.m.Y', $article); ?></span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="wmw-article__body">
|
||||
<?php echo apply_filters('the_content', $article->post_content); ?>
|
||||
</div>
|
||||
|
||||
<footer class="wmw-article__footer">
|
||||
<?php
|
||||
// Prev / Next in same wiki
|
||||
if ($wiki) {
|
||||
$articles = wmw_get_articles($wiki->ID, array('orderby' => 'meta_value_num', 'meta_key' => '_wmw_order', 'order' => 'ASC'));
|
||||
$ids = wp_list_pluck($articles, 'ID');
|
||||
$pos = array_search($article->ID, $ids);
|
||||
$prev = $pos > 0 ? get_post($ids[$pos-1]) : null;
|
||||
$next = $pos !== false && $pos < count($ids)-1 ? get_post($ids[$pos+1]) : null;
|
||||
?>
|
||||
<nav class="wmw-article-nav">
|
||||
<div class="wmw-article-nav__prev">
|
||||
<?php if ($prev): ?>
|
||||
<a href="<?php echo get_permalink($prev->ID); ?>">
|
||||
<span class="wmw-article-nav__label">← Vorheriger Artikel</span>
|
||||
<span class="wmw-article-nav__title"><?php echo esc_html($prev->post_title); ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="wmw-article-nav__next">
|
||||
<?php if ($next): ?>
|
||||
<a href="<?php echo get_permalink($next->ID); ?>">
|
||||
<span class="wmw-article-nav__label">Nächster Artikel →</span>
|
||||
<span class="wmw-article-nav__title"><?php echo esc_html($next->post_title); ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</nav>
|
||||
<?php } ?>
|
||||
</footer>
|
||||
</article>
|
||||
|
||||
<?php
|
||||
// Related Articles
|
||||
$related = array();
|
||||
if ($settings['show_related'] ?? 1) {
|
||||
$cats = get_the_terms($article->ID, 'wmw_category');
|
||||
if ($cats && !is_wp_error($cats)) {
|
||||
$cat_ids = wp_list_pluck($cats, 'term_id');
|
||||
$related = get_posts(array(
|
||||
'post_type' => 'wmw_article',
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => 4,
|
||||
'post__not_in' => array($article->ID),
|
||||
'meta_query' => array(array('key'=>'_wmw_wiki_id','value'=>wmw_get_article_wiki_id($article->ID))),
|
||||
'tax_query' => array(array('taxonomy'=>'wmw_category','field'=>'term_id','terms'=>$cat_ids)),
|
||||
));
|
||||
}
|
||||
}
|
||||
if (!empty($related)):
|
||||
?>
|
||||
<section class="wmw-related">
|
||||
<h3 class="wmw-related__title">📎 Verwandte Artikel</h3>
|
||||
<div class="wmw-related-grid">
|
||||
<?php foreach($related as $rel): ?>
|
||||
<a href="<?php echo get_permalink($rel->ID); ?>" class="wmw-related-item">
|
||||
<span class="wmw-related-item__title"><?php echo esc_html($rel->post_title); ?></span>
|
||||
<?php if ($rel->post_excerpt): ?>
|
||||
<span class="wmw-related-item__exc"><?php echo esc_html(wp_trim_words($rel->post_excerpt,12)); ?></span>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
// Track view
|
||||
jQuery(function($){
|
||||
$.post(wmwPublic.ajaxUrl, { action:'wmw_track_view', article_id: <?php echo $article->ID; ?> });
|
||||
});
|
||||
</script>
|
||||
<?php get_footer(); ?>
|
||||
15
templates/single-wmw-wiki.php
Normal file
15
templates/single-wmw-wiki.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
get_header();
|
||||
global $post;
|
||||
$settings = get_option('wmw_settings', array());
|
||||
$wiki = $post;
|
||||
?>
|
||||
<div class="wmw-page wmw-wiki-page">
|
||||
<?php if ($settings['show_breadcrumbs'] ?? 1): ?>
|
||||
<?php WMW_Frontend::render_breadcrumb($wiki); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php WMW_Frontend::render_wiki_index($wiki); ?>
|
||||
</div>
|
||||
<?php get_footer(); ?>
|
||||
112
templates/single-wmw_article.php
Normal file
112
templates/single-wmw_article.php
Normal file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) { exit; }
|
||||
get_header();
|
||||
while ( have_posts() ) :
|
||||
the_post();
|
||||
$post_id = get_the_ID();
|
||||
$wiki_id = get_post_meta( $post_id, '_wmw_wiki_id', true );
|
||||
$color = $wiki_id ? ( get_post_meta( $wiki_id, '_wmw_color', true ) ?: '#0073aa' ) : '#0073aa';
|
||||
|
||||
// Naechster / Vorheriger Artikel laden
|
||||
$siblings = [];
|
||||
if ( $wiki_id ) {
|
||||
$siblings = get_posts( [
|
||||
'post_type' => 'wmw_article',
|
||||
'numberposts' => -1,
|
||||
'post_status' => 'publish',
|
||||
'meta_key' => '_wmw_wiki_id',
|
||||
'meta_value' => $wiki_id,
|
||||
'orderby' => [ 'meta_value_num' => 'ASC', 'title' => 'ASC' ],
|
||||
] );
|
||||
}
|
||||
$prev_art = null; $next_art = null;
|
||||
foreach ( $siblings as $i => $s ) {
|
||||
if ( $s->ID === $post_id ) {
|
||||
if ( $i > 0 ) $prev_art = $siblings[ $i - 1 ];
|
||||
if ( $i < count( $siblings ) - 1 ) $next_art = $siblings[ $i + 1 ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="wmw-page-article" style="--wmw-color: <?php echo esc_attr( $color ); ?>;">
|
||||
|
||||
<div class="wmw-article-layout">
|
||||
|
||||
<!-- Sidebar Navigation -->
|
||||
<aside class="wmw-sidebar" id="wmw-sidebar">
|
||||
<?php if ( $wiki_id ) : ?>
|
||||
<div class="wmw-sidebar-header">
|
||||
<a href="<?php echo esc_url( get_permalink( $wiki_id ) ); ?>" class="wmw-sidebar-wiki-link">
|
||||
<span class="dashicons dashicons-arrow-left-alt"></span>
|
||||
<?php echo esc_html( get_the_title( $wiki_id ) ); ?>
|
||||
</a>
|
||||
</div>
|
||||
<div class="wmw-sidebar-search">
|
||||
<?php echo do_shortcode( '[wmw_search wiki_id="' . $wiki_id . '"]' ); ?>
|
||||
</div>
|
||||
<?php echo WMW_Frontend::render_wiki_content( $wiki_id, false ); ?>
|
||||
<?php endif; ?>
|
||||
</aside>
|
||||
|
||||
<!-- Artikel-Inhalt -->
|
||||
<main class="wmw-article-content" id="wmw-content">
|
||||
<?php echo do_shortcode( '[wmw_breadcrumb]' ); ?>
|
||||
|
||||
<article>
|
||||
<header class="wmw-article-header">
|
||||
<h1><?php the_title(); ?></h1>
|
||||
<div class="wmw-article-meta">
|
||||
<span class="wmw-updated">
|
||||
Aktualisiert: <?php echo esc_html( get_the_modified_date() ); ?>
|
||||
</span>
|
||||
<?php
|
||||
$tags = wp_get_post_terms( $post_id, 'wmw_tag' );
|
||||
if ( ! is_wp_error( $tags ) && ! empty( $tags ) ) :
|
||||
?>
|
||||
<div class="wmw-tags">
|
||||
<?php foreach ( $tags as $tag ) : ?>
|
||||
<a href="<?php echo esc_url( get_term_link( $tag ) ); ?>"
|
||||
class="wmw-tag">#<?php echo esc_html( $tag->name ); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="wmw-article-body">
|
||||
<?php the_content(); ?>
|
||||
</div>
|
||||
|
||||
<!-- Navigation: Prev / Next -->
|
||||
<?php if ( $prev_art || $next_art ) : ?>
|
||||
<nav class="wmw-article-nav">
|
||||
<?php if ( $prev_art ) : ?>
|
||||
<a href="<?php echo esc_url( get_permalink( $prev_art->ID ) ); ?>"
|
||||
class="wmw-nav-prev">
|
||||
<span class="dashicons dashicons-arrow-left-alt2"></span>
|
||||
<span>
|
||||
<em>Zurueck</em>
|
||||
<strong><?php echo esc_html( $prev_art->post_title ); ?></strong>
|
||||
</span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ( $next_art ) : ?>
|
||||
<a href="<?php echo esc_url( get_permalink( $next_art->ID ) ); ?>"
|
||||
class="wmw-nav-next">
|
||||
<span>
|
||||
<em>Weiter</em>
|
||||
<strong><?php echo esc_html( $next_art->post_title ); ?></strong>
|
||||
</span>
|
||||
<span class="dashicons dashicons-arrow-right-alt2"></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
</article>
|
||||
</main>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php endwhile; ?>
|
||||
<?php get_footer(); ?>
|
||||
37
templates/single-wmw_wiki.php
Normal file
37
templates/single-wmw_wiki.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) { exit; }
|
||||
get_header();
|
||||
while ( have_posts() ) :
|
||||
the_post();
|
||||
$wiki_id = get_the_ID();
|
||||
$color = get_post_meta( $wiki_id, '_wmw_color', true ) ?: '#0073aa';
|
||||
$icon_class = get_post_meta( $wiki_id, '_wmw_icon_class', true ) ?: 'dashicons-book-alt';
|
||||
$icon_url = get_post_meta( $wiki_id, '_wmw_icon_url', true );
|
||||
$version = get_post_meta( $wiki_id, '_wmw_version', true );
|
||||
?>
|
||||
<div class="wmw-page-wiki" style="--wmw-color: <?php echo esc_attr( $color ); ?>;">
|
||||
<div class="wmw-wiki-header">
|
||||
<div class="wmw-wiki-header-icon">
|
||||
<?php if ( $icon_url ) : ?>
|
||||
<img src="<?php echo esc_url( $icon_url ); ?>" alt="<?php the_title_attribute(); ?>">
|
||||
<?php else : ?>
|
||||
<span class="dashicons <?php echo esc_attr( $icon_class ); ?>"></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="wmw-wiki-header-text">
|
||||
<h1 class="wmw-wiki-title"><?php the_title(); ?></h1>
|
||||
<?php if ( $version ) : ?>
|
||||
<span class="wmw-version-badge">Version <?php echo esc_html( $version ); ?></span>
|
||||
<?php endif; ?>
|
||||
<?php if ( has_excerpt() ) : ?>
|
||||
<p class="wmw-wiki-description"><?php the_excerpt(); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ( get_the_content() ) : ?>
|
||||
<div class="wmw-wiki-intro"><?php the_content(); ?></div>
|
||||
<?php endif; ?>
|
||||
<?php echo WMW_Frontend::render_wiki_content( $wiki_id, true ); ?>
|
||||
</div>
|
||||
<?php endwhile; ?>
|
||||
<?php get_footer(); ?>
|
||||
71
templates/wiki-index.php
Normal file
71
templates/wiki-index.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?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>
|
||||
24
templates/wiki-list.php
Normal file
24
templates/wiki-list.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
|
||||
<div class="wmw-wiki-list" style="--wmw-cols:<?php echo absint($columns); ?>">
|
||||
<?php foreach ($wikis as $wiki):
|
||||
$icon = wmw_get_wiki_icon($wiki->ID);
|
||||
$color = wmw_get_wiki_color($wiki->ID);
|
||||
$count = count(wmw_get_articles($wiki->ID));
|
||||
$version = get_post_meta($wiki->ID,'_wmw_version',true) ?: '1.0.0';
|
||||
?>
|
||||
<a href="<?php echo get_permalink($wiki->ID); ?>" class="wmw-wiki-card-public" style="--wiki-color:<?php echo esc_attr($color); ?>">
|
||||
<div class="wmw-wiki-card-public__icon"><?php echo $icon; ?></div>
|
||||
<div class="wmw-wiki-card-public__body">
|
||||
<h3 class="wmw-wiki-card-public__title"><?php echo esc_html($wiki->post_title); ?></h3>
|
||||
<?php if ($wiki->post_excerpt): ?>
|
||||
<p class="wmw-wiki-card-public__desc"><?php echo esc_html(wp_trim_words($wiki->post_excerpt,12)); ?></p>
|
||||
<?php endif; ?>
|
||||
<div class="wmw-wiki-card-public__footer">
|
||||
<span class="wmw-wiki-card-public__count">📄 <?php echo $count; ?> Artikel</span>
|
||||
<span class="wmw-wiki-card-public__version">v<?php echo esc_html($version); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wmw-wiki-card-public__arrow">→</div>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
Reference in New Issue
Block a user