This commit is contained in:
IGNY8 VPS (Salman)
2026-01-10 07:04:24 +00:00
parent be2c190eca
commit ceee9ba34d
8 changed files with 269 additions and 75 deletions

View File

@@ -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>