Files
igny8/plugins/wordpress/source/igny8-wp-bridge/templates/parts/igny8-header.php
2026-01-10 06:17:38 +00:00

119 lines
5.2 KiB
PHP

<?php
/**
* IGNY8 Content Header
* Displays title, status, and metadata
*
* @package Igny8Bridge
*/
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit;
}
$status_label = igny8_format_status_label($status);
$status_class = igny8_get_status_class($status);
?>
<div class="igny8-header">
<!-- Title -->
<div class="igny8-header-title-row">
<h1 class="igny8-title"><?php the_title(); ?></h1>
</div>
<!-- Metadata Row -->
<div class="igny8-metadata-row">
<!-- Created Date -->
<div class="igny8-meta-item">
<svg class="igny8-icon" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z"/>
</svg>
<span class="igny8-meta-label">Posted:</span>
<span class="igny8-meta-value"><?php echo get_the_date(); ?></span>
</div>
<!-- Word Count -->
<?php if ($word_count > 0): ?>
<div class="igny8-meta-item">
<svg class="igny8-icon" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z"/>
</svg>
<span class="igny8-meta-label">Words:</span>
<span class="igny8-meta-value"><?php echo number_format($word_count); ?></span>
</div>
<?php endif; ?>
<!-- Author -->
<div class="igny8-meta-item">
<svg class="igny8-icon" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z"/>
</svg>
<span class="igny8-meta-label">Author:</span>
<span class="igny8-meta-value"><?php the_author(); ?></span>
</div>
<!-- Topic (Cluster Name) -->
<?php if ($cluster_name):
// Get cluster term for link
$cluster_terms = get_the_terms(get_the_ID(), 'igny8_clusters');
$cluster_link = (!empty($cluster_terms) && !is_wp_error($cluster_terms)) ? get_term_link($cluster_terms[0]) : '';
?>
<div class="igny8-meta-item">
<svg class="igny8-icon" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M5.05 4.05a7 7 0 119.9 9.9L10 18.9l-4.95-4.95a7 7 0 010-9.9zM10 11a2 2 0 100-4 2 2 0 000 4z"/>
</svg>
<span class="igny8-meta-label">Topic:</span>
<?php if ($cluster_link): ?>
<a href="<?php echo esc_url($cluster_link); ?>" class="igny8-meta-link"><?php echo esc_html($cluster_name); ?></a>
<?php else: ?>
<span class="igny8-meta-value"><?php echo esc_html($cluster_name); ?></span>
<?php endif; ?>
</div>
<?php endif; ?>
<!-- Categories -->
<?php if ($categories && !is_wp_error($categories)): ?>
<div class="igny8-meta-item">
<svg class="igny8-icon" viewBox="0 0 20 20" fill="currentColor">
<path d="M2 6a2 2 0 012-2h5l2 2h5a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6z"/>
</svg>
<span class="igny8-meta-label">Categories:</span>
<div class="igny8-meta-badges">
<?php
foreach ($categories as $cat):
// Build hierarchy path (Parent > Child)
$cat_hierarchy = [];
$current_cat = $cat;
while ($current_cat) {
array_unshift($cat_hierarchy, $current_cat);
$current_cat = ($current_cat->parent > 0) ? get_category($current_cat->parent) : null;
}
$hierarchy_text = implode(' > ', array_map(function($c) { return $c->name; }, $cat_hierarchy));
?>
<a href="<?php echo esc_url(get_category_link($cat->term_id)); ?>" class="igny8-category-badge"><?php echo esc_html($hierarchy_text); ?></a>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
<!-- Tags -->
<?php if ($tags && !is_wp_error($tags)): ?>
<div class="igny8-meta-item">
<svg class="igny8-icon" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M17.707 9.293a1 1 0 010 1.414l-7 7a1 1 0 01-1.414 0l-7-7A.997.997 0 012 10V5a3 3 0 013-3h5c.256 0 .512.098.707.293l7 7zM5 6a1 1 0 100-2 1 1 0 000 2z"/>
</svg>
<span class="igny8-meta-label">Tags:</span>
<div class="igny8-meta-badges">
<?php
// Get only tags assigned to the post (not keywords)
$post_tags = wp_get_post_tags(get_the_ID());
foreach ($post_tags as $tag):
?>
<a href="<?php echo esc_url(get_tag_link($tag->term_id)); ?>" class="igny8-tag-badge"><?php echo esc_html($tag->name); ?></a>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
</div>
</div>