feat(theme): add [roi_post_grid] shortcode for static pages

- Create PostGridShortcodeRegistrar for WordPress shortcode registration
- Implement RenderPostGridUseCase following Clean Architecture
- Add PostGridQueryBuilder for custom WP_Query construction
- Add PostGridShortcodeRenderer for HTML/CSS generation
- Register shortcode in DIContainer with proper DI
- Add shortcode usage guide in post-grid admin panel
- Fix sidebar layout: add hide_for_logged_in check to wrapper visibility

Shortcode attributes: category, tag, author, posts_per_page, columns,
show_pagination, show_thumbnail, show_excerpt, show_meta, etc.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
FrankZamora
2025-12-06 21:33:20 -06:00
parent c23dc22d76
commit 79e91f59ee
13 changed files with 1532 additions and 2 deletions

View File

@@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
namespace ROITheme\Shared\Domain\Contracts;
/**
* Interface PostGridShortcodeRendererInterface
*
* Contrato para renderizado HTML del shortcode post-grid.
* Define el comportamiento esperado para generar el HTML del grid
* sin depender de implementaciones especificas.
*
* Responsabilidades:
* - Generar HTML del grid de posts
* - Generar CSS inline usando CSSGeneratorInterface
* - Aplicar clases responsive de Bootstrap
*
* NO responsable de:
* - Construir queries
* - Obtener settings de BD
* - Sanitizar atributos del shortcode
*
* @package ROITheme\Shared\Domain\Contracts
*/
interface PostGridShortcodeRendererInterface
{
/**
* Renderiza el grid de posts como HTML.
*
* Ejemplo:
* ```php
* $html = $renderer->render($query, $settings, [
* 'columns' => 3,
* 'show_thumbnail' => true,
* 'show_excerpt' => true,
* 'id' => 'grid-cursos'
* ]);
* ```
*
* @param \WP_Query $query Query con los posts a mostrar
* @param array<string, mixed> $settings Settings del componente post-grid desde BD
* @param array<string, mixed> $options Opciones de visualizacion del shortcode
* Keys: columns, show_thumbnail, show_excerpt,
* show_meta, show_categories, excerpt_length,
* class, id, show_pagination
*
* @return string HTML completo del grid incluyendo CSS inline
*/
public function render(\WP_Query $query, array $settings, array $options): string;
}