Files
roi-theme/wp-content/themes/apus-theme/single.php
FrankZamora 2cc274d6e2 Implementar Issues #34-43 - Funcionalidades de conversión, UI/UX y SEO avanzadas
Implementación masiva de 10 funcionalidades usando agentes paralelos para máxima eficiencia.

**Issues Completados:**

**Issue #34 - Modal de Contacto con Webhook:**
- modal-contact.html: Modal Bootstrap 5 independiente
- assets/css/modal-contact.css: Estilos completos con validaciones visuales
- assets/js/modal-contact.js: Validaciones (email regex, WhatsApp 10-15 dígitos), envío webhook, GA4 tracking
- footer.php: Agregado div#modalContainer
- inc/enqueue-scripts.php: Enqueue CSS y JS

**Issue #35 - Botón Let's Talk en Navbar:**
- header.php: Botón CTA con gradiente naranja (#FF6B35 → #FF8C42)
- assets/css/custom-style.css: Animaciones hover (elevación + sombra)
- assets/js/main.js: GA4 tracking de clicks

**Issue #36 - CTA Box en Sidebar:**
- template-parts/cta-box-sidebar.php: Template reutilizable
- assets/css/cta-box-sidebar.css: Gradiente naranja-amarillo, sticky junto con TOC
- sidebar.php: Integración del CTA box
- inc/enqueue-scripts.php: Enqueue condicional (solo single posts)

**Issue #37 - Formulario de Contacto en Footer (5ta área de widgets):**
- functions.php: Registro de widget footer-contact
- footer.php: Sección completa con layout 2 columnas (info + formulario)
- assets/css/footer-contact.css: Iconos naranja, validaciones, responsive
- assets/js/footer-contact.js: Validaciones, webhook Make.com, GA4 tracking completo
- inc/enqueue-scripts.php: Enqueue condicional

**Issue #38 - Schema FAQPage Automático:**
- inc/schema-org.php: Función apus_get_faqpage_schema()
  - Detecta H3 con signo de interrogación
  - Extrae respuestas del siguiente <p>
  - Genera FAQPage con mínimo 2 preguntas, máximo 10
  - JSON-LD integrado en @graph

**Issue #39 - Top Notification Bar:**
- header.php: Barra con fondo #4C5C6B, texto turquesa #61c7cd
- assets/css/notification-bar.css: Animación slideDown, responsive
- assets/js/notification-bar.js: Cookie 7 días, cierre con Escape, ajuste navbar
- inc/enqueue-scripts.php: Enqueue de assets

**Issue #40 - Hero Section con Diseño Específico:**
- template-parts/content-hero.php: Hero con degradado azul (#1e3a5f → #2c5282)
- assets/css/hero-section.css: Badges arriba de H1, text-shadow, responsive
- single.php: Integración del hero section
- inc/template-tags.php: Función apus_get_reading_time()
- inc/enqueue-scripts.php: Enqueue condicional

**Issue #41 - Navbar con Colores RDash:**
- assets/css/custom-style.css: Navbar fondo #0E2337, links blancos, hover turquesa #61c7cd
- header.php: Clases navbar-dark, eliminado bg-white

**Issue #42 - Schema HowTo para Procesos:**
- inc/schema-org.php: Función apus_get_howto_schema()
  - Detecta secciones con id="proceso"
  - Extrae pasos de listas ordenadas <ol>
  - Genera HowTo schema con imagen y tiempo estimado
  - JSON-LD integrado en @graph

**Issue #43 - Schema VideoObject:**
- inc/schema-org.php: Funciones apus_get_video_schemas() y apus_get_vimeo_data()
  - Detecta embeds de YouTube y Vimeo
  - Genera VideoObject schemas con thumbnails
  - Cache 24h para datos de Vimeo
  - Soporte múltiples videos por post

**Limpieza de Código:**
- Eliminados TODOS los archivos .md de reportes (contaminaban el código)
- Eliminadas carpetas docs/ con documentación innecesaria
- Toda la documentación está en los issues de GitHub

**Archivos Nuevos:**
- 15 archivos funcionales (HTML, CSS, JS, PHP templates)

**Archivos Modificados:**
- 9 archivos del tema
- 16 archivos .md eliminados (limpieza)

**Estadísticas:**
- Total funciones nuevas: 70+
- Líneas de código: 5,000+ líneas
- Schemas JSON-LD: 3 nuevos (FAQPage, HowTo, VideoObject)
- Sistemas de conversión: 4 (modal, botón navbar, CTA sidebar, formulario footer)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 18:22:37 -06:00

248 lines
6.8 KiB
PHP

<?php
/**
* The template for displaying single posts
*
* This template displays individual blog posts with featured images,
* category badges, meta information, and full content.
* Prepared for TOC (Table of Contents) and related posts functionality.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
*
* @package Apus_Theme
* @since 1.0.0
*/
get_header();
// Display Hero Section (Issue #40)
get_template_part('template-parts/content', 'hero');
?>
<main id="main-content" class="site-main" role="main">
<div class="content-wrapper">
<!-- Primary Content Area -->
<div id="primary" class="content-area">
<?php
while ( have_posts() ) :
the_post();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<!-- Featured Image -->
<?php
// Use the new featured image function
echo apus_get_featured_image(
get_the_ID(),
'apus-featured-large',
array(
'loading' => 'eager',
)
);
?>
<!-- Article Header -->
<header class="entry-header">
<!-- Category Badge -->
<?php
// Display single category badge above title
apus_display_category_badge();
?>
<!-- Post Title -->
<h1 class="entry-title">
<?php the_title(); ?>
</h1>
<!-- Post Meta Information -->
<div class="entry-meta">
<span class="posted-on">
<time class="entry-date published" datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>">
<?php
printf(
/* translators: %s: post date */
esc_html__( 'Published on %s', 'apus-theme' ),
'<span class="date-text">' . esc_html( get_the_date() ) . '</span>'
);
?>
</time>
<?php
// Display updated date if different from published date
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) :
?>
<time class="updated" datetime="<?php echo esc_attr( get_the_modified_date( 'c' ) ); ?>">
<?php
printf(
/* translators: %s: post modified date */
esc_html__( 'Updated: %s', 'apus-theme' ),
'<span class="date-text">' . esc_html( get_the_modified_date() ) . '</span>'
);
?>
</time>
<?php endif; ?>
</span>
<span class="byline">
<span class="author vcard">
<?php
printf(
/* translators: %s: post author */
esc_html__( 'By %s', 'apus-theme' ),
'<a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a>'
);
?>
</span>
</span>
<?php
// Display reading time estimate
$content = get_post_field( 'post_content', get_the_ID() );
$word_count = str_word_count( wp_strip_all_tags( $content ) );
$reading_time = ceil( $word_count / 200 ); // Average reading speed: 200 words per minute
if ( $reading_time > 0 ) :
?>
<span class="reading-time">
<?php
printf(
/* translators: %s: estimated reading time in minutes */
esc_html( _n( '%s min read', '%s min read', $reading_time, 'apus-theme' ) ),
esc_html( number_format_i18n( $reading_time ) )
);
?>
</span>
<?php endif; ?>
</div><!-- .entry-meta -->
</header><!-- .entry-header -->
<!-- Table of Contents Hook -->
<!-- This hook allows plugins or child themes to insert a TOC -->
<?php do_action( 'apus_before_post_content' ); ?>
<!-- Post Content -->
<div class="entry-content">
<?php
the_content(
sprintf(
wp_kses(
/* translators: %s: Post title. Only visible to screen readers. */
__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'apus-theme' ),
array(
'span' => array(
'class' => array(),
),
)
),
get_the_title()
)
);
// Display page links for paginated posts
wp_link_pages(
array(
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'apus-theme' ),
'after' => '</div>',
)
);
?>
</div><!-- .entry-content -->
<?php
// Display social share buttons
apus_display_social_share();
?>
<?php
// Display CTA with A/B Testing (Issue #32)
get_template_part( 'template-parts/content', 'cta' );
?>
<!-- Post Footer (Tags) -->
<footer class="entry-footer">
<?php
$tags_list = get_the_tag_list( '', esc_html_x( ', ', 'list item separator', 'apus-theme' ) );
if ( $tags_list ) :
?>
<div class="tags-links">
<span class="tags-label"><?php esc_html_e( 'Tags:', 'apus-theme' ); ?></span>
<?php
/* translators: %s: list of tags */
printf( '<span class="tags-list">%s</span>', $tags_list ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?>
</div>
<?php endif; ?>
<?php
// Edit post link for logged-in users with permission
edit_post_link(
sprintf(
wp_kses(
/* translators: %s: Post title. Only visible to screen readers. */
__( 'Edit<span class="screen-reader-text"> "%s"</span>', 'apus-theme' ),
array(
'span' => array(
'class' => array(),
),
)
),
get_the_title()
),
'<span class="edit-link">',
'</span>'
);
?>
</footer><!-- .entry-footer -->
</article><!-- #post-<?php the_ID(); ?> -->
<?php
// Hook for related posts or additional content
do_action( 'apus_after_post_content' );
// Display comments section if enabled
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
// Post navigation (Previous/Next)
the_post_navigation(
array(
'prev_text' => sprintf(
'<span class="nav-subtitle">' . esc_html__( 'Previous:', 'apus-theme' ) . '</span> <span class="nav-title">%s</span>',
'%title'
),
'next_text' => sprintf(
'<span class="nav-subtitle">' . esc_html__( 'Next:', 'apus-theme' ) . '</span> <span class="nav-title">%s</span>',
'%title'
),
)
);
endwhile; // End of the loop.
?>
</div><!-- #primary -->
<?php
/**
* Sidebar
* Display the sidebar if it's active.
*/
if ( is_active_sidebar( 'sidebar-1' ) ) :
get_template_part( 'template-parts/sidebar' );
endif;
?>
</div><!-- .content-wrapper -->
</main><!-- #main-content -->
<?php
get_footer();