Files
WP-Multi-Wiki/templates/single-wmw_wiki.php
2026-03-18 21:56:40 +01:00

38 lines
1.6 KiB
PHP

<?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(); ?>