add banner-counter.php
This commit is contained in:
26
partials/banner-counter.php
Normal file
26
partials/banner-counter.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<a href="https://forum.rusgrain.org?erid=2VSb5zKAzHv" target="_blank" style="display: block; width: 240px; height: 400px; text-decoration: none; margin: 0 auto;">
|
||||||
|
<div id="banner" class="banner-left" style="position: relative; width: 100%; height: 100%; background: url('https://agroexpert.press/wp-content/uploads/2025/02/agroekspert-480h800-.jpg') no-repeat center/cover;">
|
||||||
|
<div id="countdown" style="position: absolute; bottom: 24px; right: 0px; font-family: Impact, Charcoal, sans-serif; font-size: 15px; text-transform: uppercase; background-color: green; color: white; padding: 6px 15px 6px 19px; border-bottom: 2px solid white;">
|
||||||
|
Осталось 00 дней
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function getDayText(num) {
|
||||||
|
if (num % 10 === 1 && num % 100 !== 11) return "день";
|
||||||
|
if ([2, 3, 4].includes(num % 10) && ![12, 13, 14].includes(num % 100)) return "дня";
|
||||||
|
return "дней";
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateCountdown() {
|
||||||
|
const eventDate = new Date('2025-05-28'); // Дата события
|
||||||
|
const now = new Date();
|
||||||
|
const diff = Math.max(0, Math.ceil((eventDate - now) / (1000 * 60 * 60 * 24))); // Разница в днях
|
||||||
|
|
||||||
|
document.getElementById('countdown').innerText = `Осталось ${diff} ${getDayText(diff)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateCountdown();
|
||||||
|
setInterval(updateCountdown, 86400000); // Обновление раз в день
|
||||||
|
</script>
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<?if (function_exists('ex_adv_get_banner')):
|
<?if (function_exists('ex_adv_get_banner')):
|
||||||
|
|
||||||
$left_desk_1 = ex_adv_get_banner(3);
|
$left_desk_1 = ex_adv_get_banner(3);
|
||||||
@@ -46,6 +47,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<?endif?>
|
<?endif?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?$left_mob_1 = ex_adv_get_banner(6);
|
<?$left_mob_1 = ex_adv_get_banner(6);
|
||||||
if ( $left_mob_1 !== ''):?>
|
if ( $left_mob_1 !== ''):?>
|
||||||
<div class="mobile" style="margin-top: 12px;">
|
<div class="mobile" style="margin-top: 12px;">
|
||||||
|
|||||||
@@ -53,4 +53,6 @@
|
|||||||
<?endif?>
|
<?endif?>
|
||||||
|
|
||||||
|
|
||||||
<?endif?>
|
<?endif?>
|
||||||
|
|
||||||
|
<?php get_template_part('partials/banner-counter'); ?>
|
||||||
|
|||||||
Reference in New Issue
Block a user