• Resolved ZLC

    (@kindnessville)


    Hi Nabil,

    I hope you are well! I am using your timer inline with some text to display how many days someone has left before time runs out.

    My message is Applications are now being accepted and are due in x days.

    I had 2 questions:

    1. Is there a way to remove the “0” before digits that are less than 10? So to display 09 as 9?
    2. Is there a way to dynamically change my word “days” to “day” when the timer reaches 1 day?

    If you have a solution for these, I would love to know what they are. Thank you so much for all you do.

    I hope you have a great day!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Nabil Lemsieh

    (@nlemsieh)

    Hi @kindnessville

    You can do that in the new update 2.7.0 by adding these code snippets:

    Is there a way to remove the “0” before digits that are less than 10? So to display 09 as 9?

    add_filter('hurrytimer_zero_padded_digits', '__return_false');

    To apply this to a specific timer, use this snippet instead:

    add_filter('hurrytimer_zero_padded_digits', function($return, $campaign_id){
    
        if($campaign_id == 12345){
            return false;
        }
    
        return $return;
        
    }, 10, 2);

    Note: Replace 12345 with your timer ID.

    Is there a way to dynamically change my word “days” to “day” when the timer reaches 1 day?

    The code snippet below will automatically append an “s” when the number greater than 1.
    Make sure you set the labels in the timer settings to the singular form, see this screenshot: https://jmp.sh/l7fN0aQ

    add_filter('hurrytimer_auto_pluralize', '__return_true');

    To apply this to a specific timer, use this snippet instead:

    add_filter('hurrytimer_auto_pluralize', function($return, $campaign_id){
    
        if($campaign_id == 12345){
            return true;
        }
    
        return $return;
    
    }, 10, 2);

    Note: Replace 12345 with your timer ID.

    I hope this helps!

    Best,
    Nabil

    Plugin Author Nabil Lemsieh

    (@nlemsieh)

    I’m marking this as resolved. If you have any further questions, feel free to start a new thread.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Inline formatting’ is closed to new replies.