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:
170
search.php
170
search.php
@@ -2,9 +2,15 @@
|
||||
/**
|
||||
* The template for displaying search results pages
|
||||
*
|
||||
* IMPORTANT: This theme has search functionality disabled.
|
||||
* All search attempts will be redirected to 404.
|
||||
* This template serves as a fallback and will display a 404 error.
|
||||
* Estructura unificada siguiendo el patron de single.php.
|
||||
* Usa roi_render_component() para todos los componentes.
|
||||
* La visibilidad se controla via PageVisibilityHelper::shouldShow().
|
||||
*
|
||||
* NOTA: Si se desea deshabilitar la busqueda, descomentar las lineas siguientes:
|
||||
* status_header( 404 );
|
||||
* nocache_headers();
|
||||
* include( get_404_template() );
|
||||
* exit;
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#search-result
|
||||
*
|
||||
@@ -12,117 +18,81 @@
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
// Force 404 status
|
||||
status_header( 404 );
|
||||
nocache_headers();
|
||||
|
||||
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');
|
||||
}
|
||||
?>
|
||||
|
||||
<section class="error-404 not-found search-disabled" aria-labelledby="search-error-title">
|
||||
<!-- Archive Header - Componente dinamico (detecta busqueda automaticamente) -->
|
||||
<?php
|
||||
if (function_exists('roi_render_component')) {
|
||||
echo roi_render_component('archive-header');
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Error Header -->
|
||||
<header class="page-header">
|
||||
<h1 id="search-error-title" class="page-title">
|
||||
<?php esc_html_e( 'Search Unavailable', 'roi-theme' ); ?>
|
||||
</h1>
|
||||
</header><!-- .page-header -->
|
||||
<!-- 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">
|
||||
|
||||
<!-- Error Content -->
|
||||
<div class="page-content">
|
||||
<!-- Main Content Column -->
|
||||
<div class="<?php echo esc_attr($main_col_class); ?>">
|
||||
|
||||
<p class="error-message">
|
||||
<?php esc_html_e( 'The search functionality is currently disabled on this website.', 'roi-theme' ); ?>
|
||||
</p>
|
||||
<!-- Post Grid - Componente dinamico -->
|
||||
<?php
|
||||
if (function_exists('roi_render_component')) {
|
||||
echo roi_render_component('post-grid');
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Helpful Actions -->
|
||||
<div class="error-actions">
|
||||
</div><!-- .<?php echo esc_attr($main_col_class); ?> -->
|
||||
|
||||
<h2><?php esc_html_e( 'How to find content:', 'roi-theme' ); ?></h2>
|
||||
<?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');
|
||||
}
|
||||
?>
|
||||
|
||||
<ul class="error-suggestions">
|
||||
<li>
|
||||
<a href="<?php echo esc_url( home_url( '/' ) ); ?>">
|
||||
<?php esc_html_e( 'Go to the homepage', 'roi-theme' ); ?>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<?php esc_html_e( 'Use the navigation menu above', 'roi-theme' ); ?>
|
||||
</li>
|
||||
<li>
|
||||
<?php esc_html_e( 'Browse by category below', 'roi-theme' ); ?>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- CTA Box Sidebar - Componente dinamico -->
|
||||
<?php
|
||||
if (function_exists('roi_render_component')) {
|
||||
echo roi_render_component('cta-box-sidebar');
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Categories -->
|
||||
<?php
|
||||
$categories = get_categories(
|
||||
array(
|
||||
'orderby' => 'count',
|
||||
'order' => 'DESC',
|
||||
'number' => 10,
|
||||
'hide_empty' => true,
|
||||
)
|
||||
);
|
||||
</div><!-- .row -->
|
||||
</div><!-- .container -->
|
||||
|
||||
if ( ! empty( $categories ) ) :
|
||||
?>
|
||||
<div class="categories-section">
|
||||
<h3><?php esc_html_e( 'Browse by Category', 'roi-theme' ); ?></h3>
|
||||
<ul class="categories-list" role="list">
|
||||
<?php foreach ( $categories as $category ) : ?>
|
||||
<li>
|
||||
<a href="<?php echo esc_url( get_category_link( $category->term_id ) ); ?>">
|
||||
<?php echo esc_html( $category->name ); ?>
|
||||
<span class="category-count">(<?php echo esc_html( $category->count ); ?>)</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</main><!-- #main-content -->
|
||||
|
||||
<!-- Recent Posts -->
|
||||
<?php
|
||||
$recent_posts = wp_get_recent_posts(
|
||||
array(
|
||||
'numberposts' => 10,
|
||||
'post_status' => 'publish',
|
||||
)
|
||||
);
|
||||
|
||||
if ( ! empty( $recent_posts ) ) :
|
||||
?>
|
||||
<div class="recent-posts-section">
|
||||
<h3><?php esc_html_e( 'Recent Posts', 'roi-theme' ); ?></h3>
|
||||
<ul class="recent-posts-list" role="list">
|
||||
<?php foreach ( $recent_posts as $recent ) : ?>
|
||||
<li>
|
||||
<a href="<?php echo esc_url( get_permalink( $recent['ID'] ) ); ?>">
|
||||
<?php echo esc_html( $recent['post_title'] ); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php
|
||||
wp_reset_postdata();
|
||||
endif;
|
||||
?>
|
||||
|
||||
</div><!-- .error-actions -->
|
||||
|
||||
</div><!-- .page-content -->
|
||||
|
||||
</section><!-- .error-404 -->
|
||||
|
||||
</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