refactor(template): unificar page.php con estructura de single.php

- Grid layout col-lg-9 + col-lg-3
- Incluye todos los componentes: hero, featured-image, social-share,
  cta-post, related-post, table-of-contents, cta-box-sidebar, contact-form
- Permite que cta-box-sidebar se muestre en páginas cuando show_on_pages=all

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
FrankZamora
2025-12-02 11:36:36 -06:00
parent 4cdc4db397
commit 7fb5eda108

192
page.php
View File

@@ -2,9 +2,8 @@
/** /**
* The template for displaying all pages * The template for displaying all pages
* *
* This is the template that displays all pages by default. * Replica la estructura de single.php para consistencia visual.
* Please note that this is the WordPress construct of pages and that * Grid layout: col-lg-9 (contenido) + col-lg-3 (sidebar)
* other 'pages' on your WordPress site will use a different template.
* *
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-page * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-page
* *
@@ -15,112 +14,105 @@
get_header(); get_header();
?> ?>
<main id="main-content" class="site-main" role="main"> <?php while (have_posts()) : the_post(); ?>
<div class="content-wrapper"> <main id="main-content" class="site-main" role="main">
<!-- Primary Content Area --> <!-- Hero Section - Componente dinámico -->
<div id="primary" class="content-area"> <?php
if (function_exists('roi_render_component')) {
echo roi_render_component('hero');
}
?>
<?php <!-- Main Content Grid -->
while ( have_posts() ) : <div class="container">
the_post(); <div class="row">
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <!-- Main Content Column (col-lg-9) -->
<div class="col-lg-9">
<!-- Featured Image -->
<?php if ( has_post_thumbnail() ) : ?>
<div class="post-thumbnail">
<?php
the_post_thumbnail(
'roi-featured-large',
array(
'alt' => the_title_attribute(
array(
'echo' => false,
)
),
'loading' => 'eager',
)
);
?>
</div>
<?php endif; ?>
<!-- Page Header -->
<header class="entry-header">
<h1 class="entry-title">
<?php the_title(); ?>
</h1>
</header><!-- .entry-header -->
<!-- Page Content -->
<div class="entry-content">
<?php
the_content();
// Display page links for paginated pages
wp_link_pages(
array(
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'roi-theme' ),
'after' => '</div>',
)
);
?>
</div><!-- .entry-content -->
<!-- Page Footer -->
<?php if ( get_edit_post_link() ) : ?>
<footer class="entry-footer">
<?php
// Edit post link for logged-in users with permission
edit_post_link(
sprintf(
wp_kses(
/* translators: %s: Page title. Only visible to screen readers. */
__( 'Edit<span class="screen-reader-text"> "%s"</span>', 'roi-theme' ),
array(
'span' => array(
'class' => array(),
),
)
),
get_the_title()
),
'<span class="edit-link">',
'</span>'
);
?>
</footer><!-- .entry-footer -->
<?php endif; ?>
</article><!-- #post-<?php the_ID(); ?> -->
<?php
// Display comments section if enabled
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
endwhile; // End of the loop.
?>
</div><!-- #primary -->
<!-- Featured Image - Componente dinámico -->
<?php <?php
/** if (function_exists('roi_render_component')) {
* Sidebar echo roi_render_component('featured-image');
* Display the sidebar if it's active. }
*/
if ( is_active_sidebar( 'sidebar-1' ) ) :
get_sidebar();
endif;
?> ?>
</div><!-- .content-wrapper --> <!-- Page Content -->
<article id="post-<?php the_ID(); ?>" <?php post_class('post-content'); ?>>
<?php
the_content();
</main><!-- #main-content --> wp_link_pages(array(
'before' => '<div class="page-links">' . esc_html__('Pages:', 'roi-theme'),
'after' => '</div>',
));
?>
</article>
<!-- Share Buttons - Componente dinámico -->
<?php
if (function_exists('roi_render_component')) {
echo roi_render_component('social-share');
}
?>
<!-- CTA Post - Componente dinámico -->
<?php
if (function_exists('roi_render_component')) {
echo roi_render_component('cta-post');
}
?>
<!-- Related Posts - Componente dinámico -->
<?php
if (function_exists('roi_render_component')) {
echo roi_render_component('related-post');
}
?>
<!-- Ad After Related Posts -->
<?php
if (function_exists('roi_render_ad_slot')) {
echo roi_render_ad_slot('after-related');
}
?>
</div><!-- .col-lg-9 -->
<!-- Sidebar Column (col-lg-3) -->
<div class="col-lg-3">
<div class="sidebar-sticky">
<!-- Table of Contents - Componente dinámico -->
<?php
if (function_exists('roi_render_component')) {
echo roi_render_component('table-of-contents');
}
?>
<!-- CTA Box Sidebar - Componente dinámico -->
<?php
if (function_exists('roi_render_component')) {
echo roi_render_component('cta-box-sidebar');
}
?>
</div>
</div>
</div><!-- .row -->
</div><!-- .container -->
</main><!-- #main-content -->
<?php endwhile; ?>
<!-- Contact Form Section - Componente dinámico -->
<?php
if (function_exists('roi_render_component')) {
echo roi_render_component('contact-form');
}
?>
<?php <?php
get_footer(); get_footer();