wp 1.3.0
This commit is contained in:
@@ -32,18 +32,42 @@ $reuse_pattern = [1, 0, 3, 2]; // Featured, Square1, Landscape2, Square2
|
||||
|
||||
<div class="igny8-content-body">
|
||||
|
||||
<!-- Introduction (content before first H2) -->
|
||||
<!-- Introduction with Table of Contents -->
|
||||
<?php if (!empty($parsed_content['intro'])): ?>
|
||||
<section class="igny8-intro-section">
|
||||
<div class="igny8-section-label">Opening Narrative</div>
|
||||
<div class="igny8-prose">
|
||||
<?php echo $parsed_content['intro']; ?>
|
||||
<div class="igny8-intro-grid">
|
||||
<?php if (!empty($parsed_content['sections'])): ?>
|
||||
<nav class="igny8-table-of-contents igny8-toc-inline">
|
||||
<div class="igny8-toc-header">
|
||||
<svg class="igny8-toc-icon" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fill-rule="evenodd" d="M3 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm0 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm0 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm0 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"/>
|
||||
</svg>
|
||||
<h3>Contents</h3>
|
||||
</div>
|
||||
<ol class="igny8-toc-list">
|
||||
<?php foreach ($parsed_content['sections'] as $toc_index => $toc_section): ?>
|
||||
<li>
|
||||
<a href="#<?php echo esc_attr($toc_section['id']); ?>" class="igny8-toc-link">
|
||||
<span class="igny8-toc-number"><?php echo $toc_index + 1; ?></span>
|
||||
<span class="igny8-toc-text"><?php echo esc_html($toc_section['heading']); ?></span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
<div class="igny8-prose igny8-intro-content">
|
||||
<?php echo $parsed_content['intro']; ?>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- H2 Sections with Images -->
|
||||
<?php if (!empty($parsed_content['sections'])): ?>
|
||||
<?php if (!empty($parsed_content['sections'])):
|
||||
// Track used keywords to avoid repeating badges
|
||||
$used_keywords = [];
|
||||
?>
|
||||
<?php foreach ($parsed_content['sections'] as $index => $section): ?>
|
||||
<section class="igny8-content-section" id="<?php echo esc_attr($section['id']); ?>">
|
||||
<div class="igny8-section-container">
|
||||
@@ -52,8 +76,8 @@ $reuse_pattern = [1, 0, 3, 2]; // Featured, Square1, Landscape2, Square2
|
||||
<span class="igny8-section-number"><?php echo $index + 1; ?></span>
|
||||
<div class="igny8-section-heading-wrapper">
|
||||
<?php
|
||||
// Get section badges based on keyword/tag matching
|
||||
$badges = igny8_get_section_badges($section['heading'], get_the_ID());
|
||||
// Get section badges based on keyword/tag matching (pass used_keywords by reference)
|
||||
$badges = igny8_get_section_badges($section['heading'], get_the_ID(), $used_keywords);
|
||||
if (!empty($badges)): ?>
|
||||
<div class="igny8-section-badges">
|
||||
<?php foreach ($badges as $badge_index => $badge): ?>
|
||||
@@ -71,7 +95,7 @@ $reuse_pattern = [1, 0, 3, 2]; // Featured, Square1, Landscape2, Square2
|
||||
// Determine which image to use
|
||||
$img_data = null;
|
||||
$img_url = null;
|
||||
$img_prompt = '';
|
||||
$img_caption = '';
|
||||
$img_align = 'full';
|
||||
$img_type = 'landscape';
|
||||
$show_description = igny8_show_image_description($index);
|
||||
@@ -87,10 +111,10 @@ $reuse_pattern = [1, 0, 3, 2]; // Featured, Square1, Landscape2, Square2
|
||||
$img_data = $in_article_images[$img_position];
|
||||
if (isset($img_data['attachment_id'])) {
|
||||
$img_url = wp_get_attachment_image_url($img_data['attachment_id'], 'large');
|
||||
$img_prompt = isset($img_data['prompt']) ? $img_data['prompt'] : '';
|
||||
$img_caption = isset($img_data['caption']) ? $img_data['caption'] : '';
|
||||
} elseif (isset($img_data['url'])) {
|
||||
$img_url = $img_data['url'];
|
||||
$img_prompt = isset($img_data['prompt']) ? $img_data['prompt'] : '';
|
||||
$img_caption = isset($img_data['caption']) ? $img_data['caption'] : '';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,10 +157,9 @@ $reuse_pattern = [1, 0, 3, 2]; // Featured, Square1, Landscape2, Square2
|
||||
alt="<?php echo esc_attr($section['heading']); ?>"
|
||||
class="<?php echo esc_attr($img_class); ?>"
|
||||
loading="lazy">
|
||||
<?php if ($show_description && $img_prompt): ?>
|
||||
<?php if ($show_description && $img_caption): ?>
|
||||
<figcaption class="igny8-image-caption">
|
||||
<p class="igny8-caption-label">Visual Direction</p>
|
||||
<p class="igny8-caption-text"><?php echo esc_html($img_prompt); ?></p>
|
||||
<p class="igny8-caption-text"><?php echo esc_html($img_caption); ?></p>
|
||||
</figcaption>
|
||||
<?php endif; ?>
|
||||
</figure>
|
||||
@@ -159,10 +182,9 @@ $reuse_pattern = [1, 0, 3, 2]; // Featured, Square1, Landscape2, Square2
|
||||
alt="<?php echo esc_attr($section['heading']); ?>"
|
||||
class="igny8-in-article-image"
|
||||
loading="lazy">
|
||||
<?php if ($show_description && $img_prompt): ?>
|
||||
<?php if ($show_description && $img_caption): ?>
|
||||
<figcaption class="igny8-image-caption">
|
||||
<p class="igny8-caption-label">Visual Direction</p>
|
||||
<p class="igny8-caption-text"><?php echo esc_html($img_prompt); ?></p>
|
||||
<p class="igny8-caption-text"><?php echo esc_html($img_caption); ?></p>
|
||||
</figcaption>
|
||||
<?php endif; ?>
|
||||
</figure>
|
||||
@@ -184,15 +206,14 @@ $reuse_pattern = [1, 0, 3, 2]; // Featured, Square1, Landscape2, Square2
|
||||
}
|
||||
?>
|
||||
<div class="igny8-section-content">
|
||||
<figure class="igny8-image-figure">
|
||||
<figure class="igny8-image-figure igny8-image-landscape-figure">
|
||||
<img src="<?php echo esc_url($img_url); ?>"
|
||||
alt="<?php echo esc_attr($section['heading']); ?>"
|
||||
class="<?php echo esc_attr($img_class); ?>"
|
||||
loading="lazy">
|
||||
<?php if ($show_description && $img_prompt): ?>
|
||||
<?php if ($show_description && $img_caption): ?>
|
||||
<figcaption class="igny8-image-caption">
|
||||
<p class="igny8-caption-label">Visual Direction</p>
|
||||
<p class="igny8-caption-text"><?php echo esc_html($img_prompt); ?></p>
|
||||
<p class="igny8-caption-text"><?php echo esc_html($img_caption); ?></p>
|
||||
</figcaption>
|
||||
<?php endif; ?>
|
||||
</figure>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* IGNY8 Featured Image Block
|
||||
* Displays featured image with AI prompt if available
|
||||
* Displays featured image with caption if available
|
||||
*
|
||||
* @package Igny8Bridge
|
||||
*/
|
||||
@@ -19,23 +19,17 @@ if (!$image_url) {
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="igny8-featured-image-block">
|
||||
<div class="igny8-featured-header">
|
||||
<span class="igny8-featured-label">Featured Visual</span>
|
||||
</div>
|
||||
|
||||
<div class="igny8-featured-image-block igny8-featured-fullwidth">
|
||||
<div class="igny8-featured-image-wrapper">
|
||||
<img src="<?php echo esc_url($image_url); ?>"
|
||||
alt="<?php echo esc_attr($image_alt ?: get_the_title()); ?>"
|
||||
class="igny8-featured-image igny8-image-landscape"
|
||||
style="max-width: 1024px;"
|
||||
class="igny8-featured-image"
|
||||
loading="lazy">
|
||||
</div>
|
||||
|
||||
<?php if ($featured_image_prompt): ?>
|
||||
<div class="igny8-image-prompt">
|
||||
<p class="igny8-prompt-label">AI Image Prompt</p>
|
||||
<p class="igny8-prompt-text"><?php echo esc_html($featured_image_prompt); ?></p>
|
||||
<?php if ($featured_image_caption): ?>
|
||||
<div class="igny8-image-caption">
|
||||
<p class="igny8-caption-text"><?php echo esc_html($featured_image_caption); ?></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
@@ -11,25 +11,12 @@ if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$status_label = igny8_format_status_label($status);
|
||||
$status_class = igny8_get_status_class($status);
|
||||
?>
|
||||
|
||||
<div class="igny8-header">
|
||||
<!-- Back Button -->
|
||||
<div class="igny8-header-back">
|
||||
<a href="<?php echo esc_url(get_post_type_archive_link('post')); ?>" class="igny8-back-button">
|
||||
<span class="igny8-back-icon">←</span>
|
||||
<span>Back to Posts</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Title & Status -->
|
||||
<!-- Title -->
|
||||
<div class="igny8-header-title-row">
|
||||
<h1 class="igny8-title"><?php the_title(); ?></h1>
|
||||
<span class="igny8-status-badge <?php echo esc_attr($status_class); ?>">
|
||||
<?php echo esc_html($status_label); ?>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- Metadata Row -->
|
||||
@@ -64,17 +51,33 @@ $status_class = igny8_get_status_class($status);
|
||||
</div>
|
||||
|
||||
<!-- Topic (Cluster Name) -->
|
||||
<?php if ($cluster_name): ?>
|
||||
<?php if ($cluster_name):
|
||||
// Try to find a tag or category matching the cluster name for linking
|
||||
$cluster_link = '';
|
||||
$cluster_tag = get_term_by('name', $cluster_name, 'post_tag');
|
||||
if ($cluster_tag) {
|
||||
$cluster_link = get_term_link($cluster_tag);
|
||||
} else {
|
||||
$cluster_cat = get_term_by('name', $cluster_name, 'category');
|
||||
if ($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>
|
||||
<span class="igny8-meta-value"><?php echo esc_html($cluster_name); ?></span>
|
||||
<?php if ($cluster_link && !is_wp_error($cluster_link)): ?>
|
||||
<a href="<?php echo esc_url($cluster_link); ?>" class="igny8-meta-value igny8-clickable-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 -->
|
||||
<!-- Categories (with hierarchy) -->
|
||||
<?php if ($categories && !is_wp_error($categories)): ?>
|
||||
<div class="igny8-meta-item">
|
||||
<svg class="igny8-icon" viewBox="0 0 20 20" fill="currentColor">
|
||||
@@ -82,23 +85,35 @@ $status_class = igny8_get_status_class($status);
|
||||
</svg>
|
||||
<span class="igny8-meta-label">Categories:</span>
|
||||
<div class="igny8-meta-badges">
|
||||
<?php foreach ($categories as $cat): ?>
|
||||
<span class="igny8-category-badge"><?php echo esc_html($cat->name); ?></span>
|
||||
<?php foreach ($categories as $cat):
|
||||
// Build full hierarchy path
|
||||
$hierarchy = [];
|
||||
$current_cat = $cat;
|
||||
while ($current_cat) {
|
||||
array_unshift($hierarchy, $current_cat);
|
||||
$current_cat = $current_cat->parent ? get_category($current_cat->parent) : null;
|
||||
}
|
||||
?>
|
||||
<a href="<?php echo esc_url(get_category_link($cat->term_id)); ?>" class="igny8-category-badge igny8-clickable-badge">
|
||||
<?php echo esc_html(implode(' › ', array_map(function($c) { return $c->name; }, $hierarchy))); ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Tags -->
|
||||
<?php if ($tags && !is_wp_error($tags)): ?>
|
||||
<!-- 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 as $tag): ?>
|
||||
<span class="igny8-tag-badge"><?php echo esc_html($tag->name); ?></span>
|
||||
<?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>
|
||||
|
||||
Reference in New Issue
Block a user