Files
igny8/plugins/wordpress/source/igny8-wp-bridge/templates/single-igny8-content.php
IGNY8 VPS (Salman) ceee9ba34d wp 1.3.0
2026-01-10 07:04:24 +00:00

99 lines
3.5 KiB
PHP

<?php
/**
* Single Post Template for IGNY8-Generated Content
*
* This template is automatically loaded for posts that have _igny8_content_id meta.
* It mirrors the design of the IGNY8 app content view template.
*
* @package Igny8Bridge
*/
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit;
}
// Load template functions
require_once plugin_dir_path(dirname(__FILE__)) . 'includes/template-functions.php';
get_header();
// Get IGNY8 metadata
$content_id = get_post_meta(get_the_ID(), '_igny8_content_id', true);
$task_id = get_post_meta(get_the_ID(), '_igny8_task_id', true);
$content_type = get_post_meta(get_the_ID(), '_igny8_content_type', true);
$structure = get_post_meta(get_the_ID(), '_igny8_content_structure', true);
$source = get_post_meta(get_the_ID(), '_igny8_source', true);
$primary_keyword = get_post_meta(get_the_ID(), '_igny8_primary_keyword', true);
$secondary_keywords = get_post_meta(get_the_ID(), '_igny8_secondary_keywords', true);
$cluster_name = get_post_meta(get_the_ID(), '_igny8_cluster_name', true);
$cluster_id = get_post_meta(get_the_ID(), '_igny8_cluster_id', true);
$sector_id = get_post_meta(get_the_ID(), '_igny8_sector_id', true);
$meta_title = get_post_meta(get_the_ID(), '_igny8_meta_title', true);
$meta_description = get_post_meta(get_the_ID(), '_igny8_meta_description', true);
$last_synced = get_post_meta(get_the_ID(), '_igny8_last_synced', true);
// Parse secondary keywords
$keywords_array = igny8_parse_keywords($secondary_keywords);
// Get WordPress data
$categories = get_the_category();
$tags = get_the_tags();
$word_count = igny8_calculate_word_count(get_the_content());
$status = get_post_status();
// Get images
$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();
$content = apply_filters('the_content', $content);
$parsed_content = igny8_parse_content_sections($content);
// Debug logging
if (defined('WP_DEBUG') && WP_DEBUG) {
error_log('IGNY8 Template Debug - Post ID: ' . get_the_ID());
error_log('Content length: ' . strlen($content));
error_log('Intro length: ' . strlen($parsed_content['intro']));
error_log('Sections count: ' . count($parsed_content['sections']));
if (!empty($parsed_content['sections'])) {
foreach ($parsed_content['sections'] as $idx => $sec) {
error_log('Section ' . ($idx + 1) . ': ' . $sec['heading']);
}
}
error_log('In-article images count: ' . count($in_article_images));
error_log('Imported images meta: ' . print_r(get_post_meta(get_the_ID(), '_igny8_imported_images', true), true));
}
?>
<div class="igny8-content-wrapper">
<div class="igny8-content-container">
<?php
// Header with metadata
include plugin_dir_path(__FILE__) . 'parts/igny8-header.php';
// Featured image (if exists)
if ($featured_image_id) {
include plugin_dir_path(__FILE__) . 'parts/igny8-featured-image.php';
}
// Table of Contents
include plugin_dir_path(__FILE__) . 'parts/igny8-table-of-contents.php';
// Content sections
include plugin_dir_path(__FILE__) . 'parts/igny8-content-sections.php';
// Metadata footer
include plugin_dir_path(__FILE__) . 'parts/igny8-metadata.php';
?>
</div>
</div>
<?php
get_footer();