feat(templates): add archive-header and post-grid components
- Add ArchiveHeader component (schema, renderer, formbuilder) - Add PostGrid component (schema, renderer, formbuilder) - Unify archive templates (home, archive, category, tag, author, date, search) - Add page visibility system with VisibilityDefaults - Register components in AdminDashboardRenderer - Fix boolean conversion in functions-addon.php - All 172 unit tests passed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
167
tag.php
167
tag.php
@@ -2,8 +2,9 @@
|
||||
/**
|
||||
* The template for displaying tag archive pages
|
||||
*
|
||||
* This template displays posts associated with a specific tag,
|
||||
* with tag information displayed at the top.
|
||||
* Estructura unificada siguiendo el patron de single.php.
|
||||
* Usa roi_render_component() para todos los componentes.
|
||||
* La visibilidad se controla via PageVisibilityHelper::shouldShow().
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#tag
|
||||
*
|
||||
@@ -14,118 +15,78 @@
|
||||
get_header();
|
||||
?>
|
||||
|
||||
<main id="main-content" class="site-main" role="main">
|
||||
<main id="main-content" class="site-main" role="main">
|
||||
|
||||
<div class="content-wrapper">
|
||||
<!-- Hero Section - Componente dinamico -->
|
||||
<?php
|
||||
if (function_exists('roi_render_component')) {
|
||||
echo roi_render_component('hero');
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Primary Content Area -->
|
||||
<div id="primary" class="content-area">
|
||||
<!-- Archive Header - Componente dinamico (detecta tag automaticamente) -->
|
||||
<?php
|
||||
if (function_exists('roi_render_component')) {
|
||||
echo roi_render_component('archive-header');
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if ( have_posts() ) : ?>
|
||||
<!-- Main Content Grid -->
|
||||
<?php
|
||||
// Determinar si mostrar sidebar basandose en visibilidad de componentes
|
||||
$sidebar_components = ['table-of-contents', 'cta-box-sidebar'];
|
||||
$show_sidebar = function_exists('roi_should_render_any_wrapper')
|
||||
? roi_should_render_any_wrapper($sidebar_components)
|
||||
: false;
|
||||
$main_col_class = $show_sidebar ? 'col-lg-9' : 'col-lg-12';
|
||||
?>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
||||
<!-- Tag Archive Header -->
|
||||
<header class="page-header tag-header">
|
||||
<?php
|
||||
// Tag title
|
||||
the_archive_title( '<h1 class="page-title tag-title">', '</h1>' );
|
||||
<!-- Main Content Column -->
|
||||
<div class="<?php echo esc_attr($main_col_class); ?>">
|
||||
|
||||
// Tag description
|
||||
$tag_description = tag_description();
|
||||
if ( ! empty( $tag_description ) ) :
|
||||
?>
|
||||
<div class="archive-description tag-description">
|
||||
<?php echo wp_kses_post( wpautop( $tag_description ) ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<!-- Post Grid - Componente dinamico -->
|
||||
<?php
|
||||
if (function_exists('roi_render_component')) {
|
||||
echo roi_render_component('post-grid');
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Tag metadata -->
|
||||
<?php
|
||||
$tag = get_queried_object();
|
||||
if ( $tag ) :
|
||||
?>
|
||||
<div class="tag-meta">
|
||||
<span class="tag-count">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: number of posts */
|
||||
esc_html( _n( '%s post', '%s posts', $tag->count, 'roi-theme' ) ),
|
||||
esc_html( number_format_i18n( $tag->count ) )
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</header><!-- .page-header -->
|
||||
</div><!-- .<?php echo esc_attr($main_col_class); ?> -->
|
||||
|
||||
<!-- Tag Posts Loop -->
|
||||
<div class="archive-posts tag-posts">
|
||||
<?php if ($show_sidebar): ?>
|
||||
<!-- Sidebar Column (col-lg-3) -->
|
||||
<div class="col-lg-3">
|
||||
<div class="sidebar-sticky">
|
||||
<!-- Table of Contents - Componente dinamico -->
|
||||
<?php
|
||||
if (function_exists('roi_render_component')) {
|
||||
echo roi_render_component('table-of-contents');
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
// Start the WordPress Loop
|
||||
while ( have_posts() ) :
|
||||
the_post();
|
||||
<!-- CTA Box Sidebar - Componente dinamico -->
|
||||
<?php
|
||||
if (function_exists('roi_render_component')) {
|
||||
echo roi_render_component('cta-box-sidebar');
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
/**
|
||||
* Include the Post-Type-specific template for the content.
|
||||
* If you want to override this in a child theme, then include a file
|
||||
* called content-___.php (where ___ is the Post Type name) and that will be used instead.
|
||||
*/
|
||||
get_template_part( 'template-parts/content', get_post_type() );
|
||||
</div><!-- .row -->
|
||||
</div><!-- .container -->
|
||||
|
||||
endwhile;
|
||||
?>
|
||||
</main><!-- #main-content -->
|
||||
|
||||
</div><!-- .archive-posts -->
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Pagination
|
||||
* Display navigation to next/previous set of posts when applicable.
|
||||
*/
|
||||
the_posts_pagination(
|
||||
array(
|
||||
'mid_size' => 2,
|
||||
'prev_text' => sprintf(
|
||||
'%s <span class="nav-prev-text">%s</span>',
|
||||
'<span class="nav-icon" aria-hidden="true">«</span>',
|
||||
esc_html__( 'Previous', 'roi-theme' )
|
||||
),
|
||||
'next_text' => sprintf(
|
||||
'<span class="nav-next-text">%s</span> %s',
|
||||
esc_html__( 'Next', 'roi-theme' ),
|
||||
'<span class="nav-icon" aria-hidden="true">»</span>'
|
||||
),
|
||||
'before_page_number' => '<span class="screen-reader-text">' . esc_html__( 'Page', 'roi-theme' ) . ' </span>',
|
||||
'aria_label' => esc_attr__( 'Posts navigation', 'roi-theme' ),
|
||||
)
|
||||
);
|
||||
|
||||
else :
|
||||
|
||||
/**
|
||||
* No posts found
|
||||
* Display a message when no content is available.
|
||||
*/
|
||||
get_template_part( 'template-parts/content', 'none' );
|
||||
|
||||
endif;
|
||||
?>
|
||||
|
||||
</div><!-- #primary -->
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Sidebar
|
||||
* Display the sidebar if it's active.
|
||||
*/
|
||||
if ( is_active_sidebar( 'sidebar-1' ) ) :
|
||||
get_sidebar();
|
||||
endif;
|
||||
?>
|
||||
|
||||
</div><!-- .content-wrapper -->
|
||||
|
||||
</main><!-- #main-content -->
|
||||
<!-- Contact Form Section - Componente dinamico -->
|
||||
<?php
|
||||
if (function_exists('roi_render_component')) {
|
||||
echo roi_render_component('contact-form');
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
get_footer();
|
||||
|
||||
Reference in New Issue
Block a user