Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #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

    #1294904
    #1294907

    or 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-images

    Insert 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.
    #1294991

    THX for fast reply – will test it.

    Best regards

    Marcus

    #1295424

    Hi Marcus,

    Thanks for the update, we’ll keep this thread open for you. Thanks @guenni007 for helping out :-)

    Best regards,
    Rikard

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.