Files
roi-theme/template-parts/content.php
FrankZamora de5fff4f5c Fase 1: Estructura Base y DI Container - Clean Architecture
COMPLETADO: Fase 1 de la migración a Clean Architecture + POO

## Estructura de Carpetas
- ✓ Estructura completa de 4 capas (Domain, Application, Infrastructure, Presentation)
- ✓ Carpetas de Use Cases (SaveComponent, GetComponent, DeleteComponent, SyncSchema)
- ✓ Estructura de tests (Unit, Integration, E2E)
- ✓ Carpetas de schemas y templates

## Composer y Autoloading
- ✓ PSR-4 autoloading configurado para ROITheme namespace
- ✓ Autoloader optimizado regenerado

## DI Container
- ✓ DIContainer implementado con patrón Singleton
- ✓ Métodos set(), get(), has() para gestión de servicios
- ✓ Getters específicos para ComponentRepository, ValidationService, CacheService
- ✓ Placeholders que serán implementados en Fase 5
- ✓ Prevención de clonación y deserialización

## Interfaces
- ✓ ComponentRepositoryInterface (Domain)
- ✓ ValidationServiceInterface (Application)
- ✓ CacheServiceInterface (Application)
- ✓ Component entity placeholder (Domain)

## Bootstrap
- ✓ functions.php actualizado con carga de Composer autoloader
- ✓ Inicialización del DIContainer
- ✓ Helper function roi_container() disponible globalmente

## Tests
- ✓ 10 tests unitarios para DIContainer (100% cobertura)
- ✓ Total: 13 tests unitarios, 28 assertions
- ✓ Suite de tests pasando correctamente

## Validación
- ✓ Script de validación automatizado (48/48 checks pasados)
- ✓ 100% de validaciones exitosas

La arquitectura base está lista para la Fase 2.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 13:48:24 -06:00

155 lines
4.0 KiB
PHP

<?php
/**
* Template part for displaying posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package ROI_Theme
* @since 1.0.0
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<!-- Post Header -->
<header class="entry-header">
<?php
// Display the post title
if ( is_singular() ) :
the_title( '<h1 class="entry-title">', '</h1>' );
else :
the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
endif;
// Display post meta information
if ( 'post' === get_post_type() ) :
?>
<div class="entry-meta">
<?php
// Posted on date
printf(
'<span class="posted-on"><time class="entry-date published" datetime="%1$s">%2$s</time></span>',
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() )
);
// Posted by author
printf(
'<span class="byline"> %s <span class="author vcard"><a class="url fn n" href="%s">%s</a></span></span>',
esc_html__( 'by', 'roi-theme' ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_html( get_the_author() )
);
// Comments link
if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) :
echo '<span class="comments-link">';
comments_popup_link(
esc_html__( 'Leave a comment', 'roi-theme' ),
esc_html__( '1 Comment', 'roi-theme' ),
esc_html__( '% Comments', 'roi-theme' )
);
echo '</span>';
endif;
?>
</div><!-- .entry-meta -->
<?php
endif;
?>
</header><!-- .entry-header -->
<!-- Featured Image -->
<?php if ( has_post_thumbnail() ) : ?>
<div class="post-thumbnail">
<?php
if ( is_singular() ) :
the_post_thumbnail( 'roi-featured-large', array( 'alt' => the_title_attribute( array( 'echo' => false ) ) ) );
else :
?>
<a href="<?php the_permalink(); ?>" aria-hidden="true" tabindex="-1">
<?php the_post_thumbnail( 'roi-featured-medium', array( 'alt' => the_title_attribute( array( 'echo' => false ) ) ) ); ?>
</a>
<?php
endif;
?>
</div><!-- .post-thumbnail -->
<?php endif; ?>
<!-- Post Content -->
<div class="entry-content">
<?php
// Display content or excerpt based on context
if ( is_singular() ) :
the_content(
sprintf(
wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers */
__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'roi-theme' ),
array(
'span' => array(
'class' => array(),
),
)
),
wp_kses_post( get_the_title() )
)
);
// Display pagination for multi-page posts
wp_link_pages(
array(
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'roi-theme' ),
'after' => '</div>',
)
);
else :
the_excerpt();
endif;
?>
</div><!-- .entry-content -->
<!-- Post Footer -->
<footer class="entry-footer">
<?php
// Display categories
$categories_list = get_the_category_list( esc_html__( ', ', 'roi-theme' ) );
if ( $categories_list ) :
printf(
'<span class="cat-links">%s %s</span>',
esc_html__( 'Categories:', 'roi-theme' ),
$categories_list // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
);
endif;
// Display tags
$tags_list = get_the_tag_list( '', esc_html_x( ', ', 'list item separator', 'roi-theme' ) );
if ( $tags_list ) :
printf(
'<span class="tags-links">%s %s</span>',
esc_html__( 'Tags:', 'roi-theme' ),
$tags_list // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
);
endif;
// Edit post link
edit_post_link(
sprintf(
wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers */
__( 'Edit <span class="screen-reader-text">%s</span>', 'roi-theme' ),
array(
'span' => array(
'class' => array(),
),
)
),
wp_kses_post( get_the_title() )
),
'<span class="edit-link">',
'</span>'
);
?>
</footer><!-- .entry-footer -->
</article><!-- #post-<?php the_ID(); ?> -->