-
AuthorPosts
-
September 9, 2022 at 3:14 pm #1364428
On this page I’ve added the countdown clock: https://bezzerwizzer.dk/somanyclues/
But the javascript for custom countdown text from the Enfold Documentation site doesn’t seem to work: https://kriesi.at/documentation/enfold/animated-countdown/#toggle-id-4
Here’s the javascript:
// Change countdown text function custom_countdown_text(){ ?> <script> jQuery(window).load(function(){ jQuery('.av-countdown-timer.my-custom-countdown').each(function() { jQuery(".av-countdown-time-label").replaceWith(function() { return "</p> <p> </p> <div class="+"av-countdown-time-label"+">" + this.innerHTML + "</div> <p> </p> <p>"; }); // Replace your custom text here var seconds = "Sec", minutes = "Min", hours = "Hrs", days = "D", weeks = "W", months = "M", years = "Y"; jQuery(".av-countdown-seconds .av-countdown-time-label").text(seconds); jQuery(".av-countdown-minutes .av-countdown-time-label").text(minutes); jQuery(".av-countdown-hours .av-countdown-time-label").text(hours); jQuery(".av-countdown-days .av-countdown-time-label").text(days); jQuery(".av-countdown-weeks .av-countdown-time-label").text(weeks); jQuery(".av-countdown-months .av-countdown-time-label").text(months); jQuery(".av-countdown-years .av-countdown-time-label").text(years); }); }); </script> <!--?php<br /--> } add_action('wp_head', 'custom_countdown_text');
Maybe it’s because it’s for an older version of Enfold? Don’t know but it doesn’t work for me.
- This topic was modified 2 years, 3 months ago by resting-jeppesen.
September 9, 2022 at 4:53 pm #1364447Hey Jonas,
It seems to be working on my end, could you post a screenshot highlighting the problem you are seeing on your end please?
Best regards,
RikardSeptember 12, 2022 at 9:59 am #1364674Yes I forgot to do that, sorry. When I paste it in the functions.php it gives the following error:
- This reply was modified 2 years, 3 months ago by resting-jeppesen.
September 13, 2022 at 10:43 am #1364874Hi resting-jeppesen,
Please try to replace this code:
<!--?php<br /--> }
with:
<?php
Hope this helps.
Best regards,
NikkoSeptember 15, 2022 at 8:45 am #1365081Hi Nikko
I replaced the part of the code with what you suggested but it couldn’t save. Got the same error as before. But then I added the “}” afterwards so it said “<?php }” and then it was able to save. Unfortunately, it didn’t change the countdown clock text. Any other suggestions? :)September 15, 2022 at 4:17 pm #1365159Hey,
Could you please try using following code
add_action('wp_head', 'custom_countdown_text'); function custom_countdown_text(){ ?> <script> jQuery(window).load(function(){ jQuery('.my-custom-countdown .av-countdown-time-label').each(function(x){ var new_text = jQuery(this).text().replace("Seconds", "Sec"); jQuery(this).text(new_text); })}); </script> <?php }
Cheers!
YigitSeptember 16, 2022 at 2:02 pm #1365247Hi Yigit
Unfortunately that didn’t work either. Any other ideas? :)
Should I create a login for you guys? Would that be helpful?September 16, 2022 at 5:39 pm #1365283Hi,
Thank you for your patience, as I understand your issue you would like to change the text in the count down from Seconds to Sec and Minutes to Min, correct?
Please include an admin login so we can assist.Best regards,
MikeSeptember 19, 2022 at 9:37 am #1365496Hi MIke
Yes, or to any other text that I want. It needs to be in Danish is actually what I’m looking for but obviously I’ll just add that text myself once the javascript works. I’ve added a login.
September 19, 2022 at 11:05 am #1365507Hi,
Thank you for the update.
You may need to edit the enfold/config-templatebuilder/avia-shortcodes/countdown/countdown.js directly. Please edit the script file and replace everything with the following code.
// https://pastebin.com/4SgWsmCR
Best regards,
IsmaelSeptember 19, 2022 at 11:37 am #1365510Hi Ismael
That still didn’t do anything, unfortunately. It’s proving a pesky problem!
Any other ideas?
September 19, 2022 at 12:05 pm #1365520Hi,
This modification works properly on our installation. Did you toggle or temporarily disable the Enfold > Performance > File Compression settings after editing the file? Make sure to purge the cache as well and do a hard refresh.
Thank you for your patience.
Best regards,
IsmaelSeptember 19, 2022 at 12:38 pm #1365527Perfect! I just had to purge the cache. Thanks a lot! So any visitor that’s been there needs to purge their cache for this to work?
September 19, 2022 at 12:51 pm #1365533Hi,
Typically their cache has been cleared by it’s time limit, you should not worry about this.
Your cache is different because you are working on it everyday.
Unless there is anything else we can assist with on this issue, shall we close this then?Best regards,
MikeSeptember 19, 2022 at 2:33 pm #1365546Awesome!
Thanks all of you for your help!
Yes, Mike, you can close this. :)September 19, 2022 at 4:50 pm #1365564Hi,
Great, I’m glad that we could help you out. I’ll close this thread for now then, please open a new thread if you should have any further questions or problems.
Best regards,
Rikard -
AuthorPosts
- The topic ‘Countdown clock – javascript for custom countdown text not working’ is closed to new replies.