-
AuthorPosts
-
April 17, 2021 at 10:44 am #1294889
Hallo enfold-support.
Gibt es eine Möglichkeit Inhalte wie Texte und Bilder zeitgesteuert auszutauschen. Quasi monatlich ein neues Bild einblenden oder zu bestimmten Daten bestimmte Bilder und Texte hinterlegen, die dann automatisch angezeigt werden? Bilder zeitgesteuert austauschen?
Viele Grüße
Marcus
April 17, 2021 at 3:10 pm #1294904April 17, 2021 at 3:50 pm #1294907or for example per season:
please read the code carefully. The selector where this should happen is an ID !
And the images should then also be named as in the code and the location would be in the case then /uploads/season-imagesInsert on the Element to have that scheduling an image – maybe the one that is set on default and style it as you like (cover – contain – left – top etc. pp – scroll – fixed etc)
function scheduling_per_season(){ ?> <script> var currentTime = new Date(); var month = currentTime.getMonth() + 1; var imglocation = "/wp-content/uploads/season-images/"; // put the images in this folder switch(true) { case (month >= 6 && month <= 8): var seasonImg = "summer.jpg"; var season = "summer"; break; case (month >= 9 && month <= 11): var seasonImg = "fall.jpg"; var season = "fall"; break; case (month == 12 || month == 1 || month == 2): var seasonImg = "winter.jpg"; var season = "winter"; break; default: var seasonImg = "spring.jpg"; var season = "spring"; } document.getElementById('changed_on_season').style.backgroundImage = 'url(' + imglocation + seasonImg + ')'; document.body.classList.add(season); </script> <?php } add_action('wp_footer', 'scheduling_per_season');
it will attach in addition to body a class according to the season. this seems to be more simple – because you can have on quick css rules related to the season.
Result-Page: https://webers-testseite.de/season-scheduling/
- This reply was modified 3 years, 8 months ago by Guenni007.
April 18, 2021 at 2:01 pm #1294991THX for fast reply – will test it.
Best regards
Marcus
April 20, 2021 at 6:27 am #1295424Hi Marcus,
Thanks for the update, we’ll keep this thread open for you. Thanks @guenni007 for helping out :-)
Best regards,
Rikard -
AuthorPosts
- You must be logged in to reply to this topic.