127 lines
5.7 KiB
PHP
127 lines
5.7 KiB
PHP
<?php
|
||
/**
|
||
* IGNY8 Content Header
|
||
* Displays title, status, and metadata
|
||
*
|
||
* @package Igny8Bridge
|
||
*/
|
||
|
||
// Exit if accessed directly
|
||
if (!defined('ABSPATH')) {
|
||
exit;
|
||
}
|
||
|
||
?>
|
||
|
||
<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):
|
||
// Create search URL for cluster name as fallback
|
||
$cluster_link = add_query_arg('s', urlencode($cluster_name), home_url('/'));
|
||
|
||
// Try to find a tag or category matching the cluster name
|
||
$cluster_tag = get_term_by('name', $cluster_name, 'post_tag');
|
||
if ($cluster_tag && !is_wp_error($cluster_tag)) {
|
||
$cluster_link = get_term_link($cluster_tag);
|
||
} else {
|
||
$cluster_cat = get_term_by('name', $cluster_name, 'category');
|
||
if ($cluster_cat && !is_wp_error($cluster_cat)) {
|
||
$cluster_link = get_term_link($cluster_cat);
|
||
}
|
||
}
|
||
?>
|
||
<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>
|
||
<a href="<?php echo esc_url($cluster_link); ?>" class="igny8-meta-value igny8-clickable-link"><?php echo esc_html($cluster_name); ?></a>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<!-- Categories (each level separately clickable) -->
|
||
<?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 full hierarchy path with each level clickable
|
||
$hierarchy = [];
|
||
$current_cat = $cat;
|
||
while ($current_cat) {
|
||
array_unshift($hierarchy, $current_cat);
|
||
$current_cat = $current_cat->parent ? get_category($current_cat->parent) : null;
|
||
}
|
||
|
||
// Output each category in hierarchy as separate clickable link
|
||
$hierarchy_links = [];
|
||
foreach ($hierarchy as $h_cat) {
|
||
$hierarchy_links[] = '<a href="' . esc_url(get_category_link($h_cat->term_id)) . '" class="igny8-category-link">' . esc_html($h_cat->name) . '</a>';
|
||
}
|
||
?>
|
||
<span class="igny8-category-badge">
|
||
<?php echo implode(' <span class="igny8-cat-separator">›</span> ', $hierarchy_links); ?>
|
||
</span>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<!-- Tags (limit to 5) -->
|
||
<?php if ($tags && !is_wp_error($tags)):
|
||
$tags_to_show = array_slice($tags, 0, 5);
|
||
?>
|
||
<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 foreach ($tags_to_show as $tag): ?>
|
||
<a href="<?php echo esc_url(get_tag_link($tag->term_id)); ?>" class="igny8-tag-badge igny8-clickable-badge"><?php echo esc_html($tag->name); ?></a>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|