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

    #1364447

    Hey 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,
    Rikard

    #1364674

    Yes I forgot to do that, sorry. When I paste it in the functions.php it gives the following error:

    https://imgur.com/a/hKq9o4g

    #1364874

    Hi resting-jeppesen,

    Please try to replace this code:

    <!--?php<br /--> }

    with:

    <?php

    Hope this helps.

    Best regards,
    Nikko

    #1365081

    Hi 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? :)

    #1365159

    Hey,

    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!
    Yigit

    #1365247

    Hi Yigit

    Unfortunately that didn’t work either. Any other ideas? :)
    Should I create a login for you guys? Would that be helpful?

    #1365283

    Hi,
    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,
    Mike

    #1365496

    Hi 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.

    #1365507

    Hi,

    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,
    Ismael

    #1365510

    Hi Ismael

    That still didn’t do anything, unfortunately. It’s proving a pesky problem!

    Any other ideas?

    #1365520

    Hi,

    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,
    Ismael

    #1365527

    Perfect! 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?

    #1365533

    Hi,
    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,
    Mike

    #1365546

    Awesome!
    Thanks all of you for your help!
    Yes, Mike, you can close this. :)

    #1365564

    Hi,

    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

Viewing 16 posts - 1 through 16 (of 16 total)
  • The topic ‘Countdown clock – javascript for custom countdown text not working’ is closed to new replies.