WP Seasonal Logo Rotator (Auto-Scan Hack)

WP Seasonal Logo Rotator (Auto-Scan Hack) 1.0.0

没有下载权限
XF 兼容性
  1. 2.3.x
摘要
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.
WP Seasonal Logo Rotator (Auto-Scan Hack)

A lightweight template hack to automatically rotate forum logos for seasons, events, or subtle brand refreshes simply by dropping images into a folder.

No add-ons.
No filename editing.
No maintenance.

What This Does
Scans a logo folder automatically
Selects one image at random on each page load
Updates instantly when images are added or removed
Ideal for seasonal or event-based branding

Installation

1. Create a logo folder

Create this folder on your server:
/styles/season_logos/
2. Add list.php

Create list.php inside the same 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);
Optional check:
3. Add CSS

Admin Panel → Appearance → Styles → Templates → 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;
}
Adjust width/height to match your logo.



4. Add JavaScript

Admin Panel → Appearance → Templates → PAGE_CONTAINER
Paste after {$ldJsonHtml|raw}
代码:
<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>
Notes
  • Logo changes on each page load
  • Clear browser cache after setup
  • Mobile sizing may need adjustment in extra.less
  • list.php exposes image filenames only



Disclaimer
This is a simple template hack, not an add-on.
Use only if you are comfortable exposing logo filenames via list.php.
  • 点赞
反应: l1admin689
作者
axtona
浏览
243
扩展类型
rar
文件大小
489 字节
首次发布
上次更新
评分 0.00 星 0 个评分
链接失效了吗? 发送消息 给 NP 团队,我们会尽快为您处理!
支持开发者 如果您对测试满意或项目已成功盈利,可点击「更多信息」按钮,通过购买来支持开发者!

来自 axtona 的更多资源

[Ap Yazılım] Scroll Buttons A
Scroll Buttons is a powerful interface add-on coded with modern web trends t
Shack Open Graph Pro A
这个扩展程序为您的网站添加了Open Graph和Twitter卡标签
 ALTACHA CAPTCHA A
一个集成ALTCHA人机验证系统的XenForo插件

相似的资源

German translation for [021] ChatGPT Autoresponder W
the german translation Deutsch (Du) for the [021] ChatGPT Autoresponder add-on
浏览
353
已更新
[021] ChatGPT Autoresponder Türkçe Çeviri Translation A
This is the Turkish translation of the description.
浏览
580
已更新
顶部