Implementación de correcciones críticas de estructura HTML base para replicar exactamente el template RDash. Todas las correcciones validadas en staging con wp-debug plugin. **Issue #68 - Sidebar Sticky (CRÍTICO):** - sidebar.php: Eliminado wrapper <aside id="secondary"> - sidebar.php: Agregado <div class="sidebar-sticky position-sticky" style="top: 5rem;"> - sidebar.php: Eliminado <div class="sidebar-inner"> innecesario - single.php línea 245: Cambiado get_template_part('template-parts/sidebar') → get_sidebar() - Resultado: Sidebar ahora flota al lado del contenido (sticky funcional) - Template ref: index.html líneas 1164-1194 **Issue #66 - Navbar Structure:** - header.php: Eliminado navbar-brand completo (logo NO debe existir) - header.php: Movido navbar-toggler para ser PRIMERO dentro de container - header.php: Removido ms-auto de navbar-nav menu - Resultado: Orden correcto (Toggler → Collapse con menú) - Template ref: index.html líneas 264-320 **Issue #67 - Notification Bar:** - header.php: Cambiado container-fluid → container - header.php: Eliminado botón close completo (NO existe en template) - header.php: Removido position-relative de flex div - Resultado: Notification bar con estructura correcta - Template ref: index.html líneas 253-262 **Issue #69 - Footer Classes:** - footer.php línea 85: Eliminado id="colophon" class="site-footer" - footer.php línea 85: Agregado class="py-5 mt-0 bg-dark text-white" - Resultado: Footer con clases Bootstrap correctas - Template ref: index.html línea 1267 **Validación en Staging:** ✅ Sidebar sticky: <div class="sidebar-sticky position-sticky" style="top: 5rem;"> presente ✅ Navbar: Toggler primero, sin logo, sin ms-auto ✅ Notification bar: container, sin botón close ✅ Footer: clases py-5 mt-0 bg-dark text-white ✅ PHP syntax: 0 errores en 4 archivos ✅ WP Debug: Templates y template parts cargando correctamente **Estadísticas:** - 4 archivos modificados (sidebar, single, header, footer) - 27 inserciones, 47 eliminaciones (net -20 líneas) - 4 issues completados (#68 CRÍTICO, #66, #67, #69) - Template RDash index.html: 1333 líneas referenciadas 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
258 lines
7.1 KiB
PHP
258 lines
7.1 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">
|
|
|
|
<!-- Container Bootstrap exacto del template -->
|
|
<div class="container">
|
|
<div class="row">
|
|
|
|
<!-- Columna Principal (9/12) - Template línea 349 -->
|
|
<div class="col-lg-9">
|
|
<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 -->
|
|
</div><!-- .col-lg-9 -->
|
|
|
|
<!-- Columna Sidebar (3/12) - Template línea 1164+ -->
|
|
<?php
|
|
/**
|
|
* Sidebar
|
|
* Display the sidebar if it's active.
|
|
*/
|
|
if ( is_active_sidebar( 'sidebar-1' ) ) :
|
|
?>
|
|
<div class="col-lg-3">
|
|
<?php get_sidebar(); ?>
|
|
</div><!-- .col-lg-3 -->
|
|
<?php
|
|
endif;
|
|
?>
|
|
|
|
</div><!-- .row -->
|
|
</div><!-- .container -->
|
|
|
|
</main><!-- #main-content -->
|
|
|
|
<?php
|
|
get_footer();
|