wp 1.3.0
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* Plugin Name: IGNY8 WordPress Bridge
|
||||
* Plugin URI: https://igny8.com/igny8-wp-bridge
|
||||
* Description: Lightweight bridge plugin that connects WordPress to IGNY8 API for one-way content publishing.
|
||||
* Version: 1.2.9
|
||||
* Version: 1.3.0
|
||||
* Author: IGNY8
|
||||
* Author URI: https://igny8.com/
|
||||
* License: GPL v2 or later
|
||||
@@ -22,7 +22,7 @@ if (!defined('ABSPATH')) {
|
||||
}
|
||||
|
||||
// Define plugin constants
|
||||
define('IGNY8_BRIDGE_VERSION', '1.2.9');
|
||||
define('IGNY8_BRIDGE_VERSION', '1.3.0');
|
||||
define('IGNY8_BRIDGE_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
||||
define('IGNY8_BRIDGE_PLUGIN_URL', plugin_dir_url(__FILE__));
|
||||
define('IGNY8_BRIDGE_PLUGIN_FILE', __FILE__);
|
||||
|
||||
@@ -129,6 +129,28 @@ function igny8_get_featured_image_prompt($post_id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get featured image caption from imported images meta
|
||||
*
|
||||
* @param int $post_id Post ID
|
||||
* @return string|null Image caption or null
|
||||
*/
|
||||
function igny8_get_featured_image_caption($post_id) {
|
||||
$imported_images = get_post_meta($post_id, '_igny8_imported_images', true);
|
||||
|
||||
if (empty($imported_images) || !is_array($imported_images)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach ($imported_images as $img) {
|
||||
if (isset($img['is_featured']) && $img['is_featured'] && isset($img['caption'])) {
|
||||
return $img['caption'];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format status label for display
|
||||
*
|
||||
@@ -202,12 +224,21 @@ function igny8_parse_keywords($keywords) {
|
||||
|
||||
/**
|
||||
* Get section badges based on keyword/tag matching
|
||||
* Returns only ONE badge per section and tracks used keywords to avoid repeats
|
||||
*
|
||||
* @param string $heading Section heading text
|
||||
* @param int $post_id Post ID
|
||||
* @return array Array of badges with 'text' and 'type' keys
|
||||
* @param array &$used_keywords Reference to array tracking already-used keywords
|
||||
* @return array Array of badges with 'text' and 'type' keys (max 1)
|
||||
*/
|
||||
function igny8_get_section_badges($heading, $post_id) {
|
||||
function igny8_get_section_badges($heading, $post_id, &$used_keywords = null) {
|
||||
// Initialize static variable to track used keywords across calls if not passed
|
||||
static $static_used_keywords = [];
|
||||
|
||||
if ($used_keywords === null) {
|
||||
$used_keywords = &$static_used_keywords;
|
||||
}
|
||||
|
||||
$badges = [];
|
||||
$heading_lower = strtolower($heading);
|
||||
|
||||
@@ -217,39 +248,49 @@ function igny8_get_section_badges($heading, $post_id) {
|
||||
$primary_kw = get_post_meta($post_id, '_igny8_primary_keyword', true);
|
||||
$secondary_kws = get_post_meta($post_id, '_igny8_secondary_keywords', true);
|
||||
|
||||
// Priority 1: Primary keyword
|
||||
if ($primary_kw && stripos($heading_lower, strtolower($primary_kw)) !== false) {
|
||||
$badges[] = ['text' => $primary_kw, 'type' => 'primary'];
|
||||
// Priority 1: Primary keyword (if not already used)
|
||||
if ($primary_kw && !in_array(strtolower($primary_kw), $used_keywords)) {
|
||||
if (stripos($heading_lower, strtolower($primary_kw)) !== false) {
|
||||
$badges[] = ['text' => $primary_kw, 'type' => 'primary'];
|
||||
$used_keywords[] = strtolower($primary_kw);
|
||||
return $badges; // Return only 1
|
||||
}
|
||||
}
|
||||
|
||||
// Priority 2: Tags
|
||||
if ($tags && !is_wp_error($tags) && count($badges) < 2) {
|
||||
// Priority 2: Tags (if not already used)
|
||||
if ($tags && !is_wp_error($tags) && count($badges) < 1) {
|
||||
foreach ($tags as $tag) {
|
||||
if (stripos($heading_lower, strtolower($tag->name)) !== false) {
|
||||
$tag_lower = strtolower($tag->name);
|
||||
if (!in_array($tag_lower, $used_keywords) && stripos($heading_lower, $tag_lower) !== false) {
|
||||
$badges[] = ['text' => $tag->name, 'type' => 'tag'];
|
||||
if (count($badges) >= 2) break;
|
||||
$used_keywords[] = $tag_lower;
|
||||
return $badges; // Return only 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Priority 3: Categories
|
||||
if ($categories && !is_wp_error($categories) && count($badges) < 2) {
|
||||
// Priority 3: Categories (if not already used)
|
||||
if ($categories && !is_wp_error($categories) && count($badges) < 1) {
|
||||
foreach ($categories as $cat) {
|
||||
if (stripos($heading_lower, strtolower($cat->name)) !== false) {
|
||||
$cat_lower = strtolower($cat->name);
|
||||
if (!in_array($cat_lower, $used_keywords) && stripos($heading_lower, $cat_lower) !== false) {
|
||||
$badges[] = ['text' => $cat->name, 'type' => 'category'];
|
||||
if (count($badges) >= 2) break;
|
||||
$used_keywords[] = $cat_lower;
|
||||
return $badges; // Return only 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Priority 4: Secondary keywords
|
||||
if ($secondary_kws && count($badges) < 2) {
|
||||
// Priority 4: Secondary keywords (if not already used)
|
||||
if ($secondary_kws && count($badges) < 1) {
|
||||
$kw_array = is_array($secondary_kws) ? $secondary_kws : explode(',', $secondary_kws);
|
||||
foreach ($kw_array as $kw) {
|
||||
$kw = trim($kw);
|
||||
if (!empty($kw) && stripos($heading_lower, strtolower($kw)) !== false) {
|
||||
$kw_lower = strtolower($kw);
|
||||
if (!empty($kw) && !in_array($kw_lower, $used_keywords) && stripos($heading_lower, $kw_lower) !== false) {
|
||||
$badges[] = ['text' => $kw, 'type' => 'keyword'];
|
||||
if (count($badges) >= 2) break;
|
||||
$used_keywords[] = $kw_lower;
|
||||
return $badges; // Return only 1
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -257,6 +298,15 @@ function igny8_get_section_badges($heading, $post_id) {
|
||||
return $badges;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the used keywords tracker (call at start of template)
|
||||
*/
|
||||
function igny8_reset_used_keywords() {
|
||||
// Reset the static variable by calling with empty reference
|
||||
$empty = [];
|
||||
igny8_get_section_badges('', 0, $empty);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if section content contains a table
|
||||
*
|
||||
|
||||
@@ -847,6 +847,7 @@ function igny8_set_featured_image($post_id, $image_data) {
|
||||
|
||||
/**
|
||||
* Set image gallery for post (1-5 images)
|
||||
* Also saves structured image metadata with caption, prompt, position, and is_featured
|
||||
*
|
||||
* @param int $post_id Post ID
|
||||
* @param array $gallery_images Array of image URLs or image data
|
||||
@@ -854,11 +855,12 @@ function igny8_set_featured_image($post_id, $image_data) {
|
||||
*/
|
||||
function igny8_set_image_gallery($post_id, $gallery_images) {
|
||||
$attachment_ids = array();
|
||||
$imported_images_meta = array();
|
||||
|
||||
// Limit to 5 images
|
||||
$gallery_images = array_slice($gallery_images, 0, 5);
|
||||
|
||||
foreach ($gallery_images as $image_data) {
|
||||
foreach ($gallery_images as $index => $image_data) {
|
||||
$image_url = is_array($image_data) ? ($image_data['url'] ?? $image_data['src'] ?? '') : $image_data;
|
||||
|
||||
if (empty($image_url)) {
|
||||
@@ -875,6 +877,18 @@ function igny8_set_image_gallery($post_id, $gallery_images) {
|
||||
|
||||
if ($attachment_id) {
|
||||
$attachment_ids[] = $attachment_id;
|
||||
|
||||
// Build structured image data for template use
|
||||
$img_meta = array(
|
||||
'attachment_id' => $attachment_id,
|
||||
'url' => wp_get_attachment_url($attachment_id),
|
||||
'position' => is_array($image_data) ? (isset($image_data['position']) ? intval($image_data['position']) : $index) : $index,
|
||||
'prompt' => is_array($image_data) ? ($image_data['prompt'] ?? '') : '',
|
||||
'caption' => is_array($image_data) ? ($image_data['caption'] ?? '') : '',
|
||||
'is_featured' => is_array($image_data) ? (isset($image_data['is_featured']) && $image_data['is_featured']) : false,
|
||||
);
|
||||
|
||||
$imported_images_meta[] = $img_meta;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -887,6 +901,11 @@ function igny8_set_image_gallery($post_id, $gallery_images) {
|
||||
update_post_meta($post_id, '_gallery_images', $attachment_ids); // Generic
|
||||
}
|
||||
|
||||
// Store structured image metadata for template rendering
|
||||
if (!empty($imported_images_meta)) {
|
||||
update_post_meta($post_id, '_igny8_imported_images', $imported_images_meta);
|
||||
}
|
||||
|
||||
return $attachment_ids;
|
||||
}
|
||||
|
||||
|
||||
@@ -852,3 +852,97 @@
|
||||
break-inside: avoid;
|
||||
}
|
||||
}
|
||||
|
||||
/* === Clickable Links & Badges === */
|
||||
.igny8-clickable-link {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
|
||||
.igny8-clickable-link:hover {
|
||||
color: var(--igny8-theme-color);
|
||||
}
|
||||
|
||||
.igny8-clickable-badge {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
transition: background-color 0.2s ease, border-color 0.2s ease;
|
||||
}
|
||||
|
||||
.igny8-clickable-badge:hover {
|
||||
background: rgba(59, 130, 246, 0.15);
|
||||
border-color: rgba(59, 130, 246, 0.3);
|
||||
color: var(--igny8-theme-color);
|
||||
}
|
||||
|
||||
/* === Intro Grid Layout (TOC 33% / Content 66%) === */
|
||||
.igny8-intro-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.igny8-intro-grid {
|
||||
grid-template-columns: 1fr 2fr;
|
||||
gap: 3rem;
|
||||
}
|
||||
}
|
||||
|
||||
.igny8-toc-inline {
|
||||
margin-bottom: 0;
|
||||
height: fit-content;
|
||||
position: sticky;
|
||||
top: 2rem;
|
||||
}
|
||||
|
||||
.igny8-intro-content {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* === Featured Image Full Width === */
|
||||
.igny8-featured-fullwidth {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.igny8-featured-fullwidth .igny8-featured-image-wrapper {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.igny8-featured-fullwidth .igny8-featured-image {
|
||||
width: 100%;
|
||||
max-width: none;
|
||||
height: auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.igny8-featured-fullwidth .igny8-image-caption {
|
||||
padding: 1rem 2rem;
|
||||
}
|
||||
|
||||
/* === Landscape Image Card Fit === */
|
||||
.igny8-image-landscape-figure {
|
||||
width: fit-content;
|
||||
max-width: 100%;
|
||||
margin: 0 auto 2rem;
|
||||
}
|
||||
|
||||
.igny8-image-landscape-figure .igny8-image-landscape {
|
||||
max-width: 100%;
|
||||
width: auto;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/* === Blockquote Fix (prevent overlap with floated images) === */
|
||||
.igny8-prose blockquote {
|
||||
clear: both;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* === Ensure proper content flow around floated images === */
|
||||
.igny8-section-content::after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -46,6 +46,7 @@ $status = get_post_status();
|
||||
$featured_image_id = get_post_thumbnail_id();
|
||||
$in_article_images = igny8_get_in_article_images(get_the_ID());
|
||||
$featured_image_prompt = igny8_get_featured_image_prompt(get_the_ID());
|
||||
$featured_image_caption = igny8_get_featured_image_caption(get_the_ID());
|
||||
|
||||
// Parse content into sections
|
||||
$content = get_the_content();
|
||||
|
||||
Reference in New Issue
Block a user