- Compatibilidade com XF
- 2.3.x
- Descrição curta
- 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.
Cria um folder de logomarcas
Crie este folder no servidor:
Checagem opcional:
Ajuste largura/ealtura para se encaixar em seu logotipo.
Adicione JavaScriptPainel de Administração → Aparência → Temas →PAGINA_CONTANDEIRAColoqueapós{$ldJsonHtml|raw}
Notas
DisclaimerEste é um hack de modelo simples, não é uma adição.
Use apenas se estiver confortável expor nomes de arquivos de logomarca via list.php.
Crie este folder no servidor:
2. Adicione list.phpCriar list.php dentro do mesmo folder.
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);
Adicione CSSAdministrador de Painel → Aparência → Estilos → Temas →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;
}
Adicione JavaScriptPainel de Administração → Aparência → Temas →PAGINA_CONTANDEIRAColoqueapó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 exibe apenas os nomes de arquivos das imagens
DisclaimerEste é um hack de modelo simples, não é uma adição.
Use apenas se estiver confortável expor nomes de arquivos de logomarca via list.php.