How to insert custom code into a sidebar (Php included)
-
Hi there, I have this code to add something like a timer / countdown specify to a site :
<script type="text/javascript"> //Variables var epoch_time = <?= time() ?>000; var startHour = 19; var finalHour = 3; //Funcion principal function timer_test() { var date1 = new Date(epoch_time); var seconds = date1.getSeconds(); var minutes = date1.getMinutes(); var hours = date1.getHours(); var diferencehours = startHour - hours -1; var diferenceminutes = 60 - minutes -1; var diferenceseconds = 60 - seconds; if (hours >= startHour || hours < finalHour) { $("#timer").html("All of our services are running."); } else if(hours < startHour && hours >= finalHour) { $("#timer").html(diferencehours + ":" + diferenceminutes + ":" + diferenceseconds); } epoch_time += 1000; } $(function() { //Interval setInterval(timer_test,1000); }); </script>
And I have a DIV called timer, where I will post the timer.
So, how do I include this script? Adding full script + id to a text widget into a sidebar doesn’t work (Exclude php code it seems)
Thanks
- The topic ‘How to insert custom code into a sidebar (Php included)’ is closed to new replies.