- Compatibilidad con XF
- 2.3.x
- Descripción breve
- A lightweight WP Seasonal Logo Rotator template hack for automatic logo rotation without add-ons or maintenance. Ideal for seasonal branding with just image uploads in a folder. No filename editing needed. Installation steps included.
Crear un folder de logotipos en tu servidor:
Verificación opcional:
Ajusta ancho/alto para que se ajusten a tu logotipo.
4. Agrega JavaScriptPanel Administrativo → Apariencia → Plantillas →PÁGINA_CONTENEDORAPastadespués{$ldJsonHtml|raw}
Notas
DisclaimerEste es un hack de plantilla, no es una adición.
Usarlo solo si estás cómodo expoliendo los nombres de archivos de logotipos a través de list.php.
2. Agregar list.phpCrear list.php dentro de la misma carpeta.
PHP:
<?php
header('Content-Type: application/json');
$allowed = ['webp', 'png', 'jpg', 'jpeg', 'gif', 'svg'];
$files = [];
foreach (scandir(__DIR__) as $file) {
if ($file === '.' || $file === '..' || $file === 'list.php') continue;
if (in_array(strtolower(pathinfo($file, PATHINFO_EXTENSION)), $allowed, true)) {
$files[] = $file;
}
}
echo json_encode($files);
Añade CSSPanel Administrativo → Apariencia → Estilos → Plantillas →extra.less
CSS:
.p-header-logo {
position: relative;
width: 350px;
height: 300px;
}
.p-header-logo img {
visibility: hidden;
}
.p-header-logo::before {
content: "";
position: absolute;
inset: 0;
background-repeat: no-repeat;
background-position: center;
background-size: contain;
}
4. Agrega JavaScriptPanel Administrativo → Apariencia → Plantillas →PÁGINA_CONTENEDORAPastadespués{$ldJsonHtml|raw}
Código:
<script>
(async function () {
const folderPath = '/styles/season_logos/';
try {
const res = await fetch(folderPath + 'list.php');
if (!res.ok) return;
const logos = await res.json();
if (!logos.length) return;
const logo = logos[Math.floor(Math.random() * logos.length)];
const style = document.createElement('style');
style.textContent = `
.p-header-logo::before {
background-image: url("${folderPath}${logo}");
}
`;
document.head.appendChild(style);
} catch (e) {}
})();
</script>
- *list.php expone nombres de archivos de imágenes solo
DisclaimerEste es un hack de plantilla, no es una adición.
Usarlo solo si estás cómodo expoliendo los nombres de archivos de logotipos a través de list.php.