feat(theme-settings): agregar configuracion de ancho del contenedor
- Nuevo grupo 'Layout y Contenedor' en theme-settings - Opciones: 1140px, 1200px, 1320px (default), 1400px, 100% - CSS dinamico aplicado via ThemeSettingsRenderer - Corregir selectores de hero en Rail Ads (.hero-section, .featured-image-container) - Agregar setTimeout para esperar carga de DOM - Aumentar gap de separacion a 30px - Subir maxTop al 40% del viewport 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -50,6 +50,7 @@ final class ThemeSettingsRenderer implements RendererInterface
|
||||
* Genera contenido para wp_head
|
||||
*
|
||||
* Incluye:
|
||||
* - Layout CSS (container width)
|
||||
* - Custom CSS (si configurado)
|
||||
* - Custom JS Header (si configurado)
|
||||
*
|
||||
@@ -60,6 +61,12 @@ final class ThemeSettingsRenderer implements RendererInterface
|
||||
{
|
||||
$output = '';
|
||||
|
||||
// Layout CSS (container width configurable)
|
||||
$layoutOutput = $this->renderLayoutCSS($data);
|
||||
if (!empty($layoutOutput)) {
|
||||
$output .= $layoutOutput . "\n";
|
||||
}
|
||||
|
||||
// Custom CSS
|
||||
$cssOutput = $this->renderCustomCSS($data);
|
||||
if (!empty($cssOutput)) {
|
||||
@@ -75,6 +82,47 @@ final class ThemeSettingsRenderer implements RendererInterface
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Genera CSS para el layout configurable
|
||||
*
|
||||
* @param array $data Datos del componente
|
||||
* @return string Bloque style o vacio si usa defaults
|
||||
*/
|
||||
private function renderLayoutCSS(array $data): string
|
||||
{
|
||||
$containerWidth = $data['layout']['container_max_width'] ?? '1320';
|
||||
|
||||
// Si es el valor default, no generar CSS extra
|
||||
if ($containerWidth === '1320') {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Validar que el valor sea seguro
|
||||
$allowedWidths = ['1140', '1200', '1320', '1400', '100%'];
|
||||
if (!in_array($containerWidth, $allowedWidths, true)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Generar el CSS
|
||||
$widthValue = ($containerWidth === '100%') ? '100%' : $containerWidth . 'px';
|
||||
|
||||
return sprintf(
|
||||
'<!-- Layout CSS (ROI Theme) -->
|
||||
<style id="roi-theme-layout-css">
|
||||
/* Container width override */
|
||||
@media (min-width: 1200px) {
|
||||
.container,
|
||||
.container-lg,
|
||||
.container-xl,
|
||||
.container-xxl {
|
||||
max-width: %s;
|
||||
}
|
||||
}
|
||||
</style>',
|
||||
esc_attr($widthValue)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Genera contenido para wp_footer
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user