How to Change the Labels in the Countdown style?

Have you ever thought of changing the labels seen in Countdown style?

You can do that using the filter we are about to introduce in this article. But, before we move on, it is important for you to make note of the style ID of the popup you wish to implement the change in.

Here is a screenshot that will help you identify the style ID of the popup.

Add the style ID in the code below. This code has to be added to the functions.php file of your theme.

/**
 * to change lables for countdown style
 */ 
add_filter( 'cp_change_countdown_label', 'cp_change_label_function', 10, 3 );

function cp_change_label_function( $label_arr, $style_id ){    

    // Replace style id with your style ID
    if( $style_id == 'cp_id_db11b' ) {
        $label_arr = array('Año', 'Mes', 'Semanas', 'Días', 'Horas', 'Minutos', 'Segundos'); // if you want labels for this specific style id in spanish then change values form array in spanish
    }
    return $label_arr;    
}

/**
 * to change compact lables for countdown style
 */ 
add_filter( 'cp_change_countdown_cmp_label', 'cp_change_cmp_label_function', 10, 3 );

function cp_change_cmp_label_function( $compact_labels, $style_id ){    
    // Replace style id with your style ID
    if( $style_id == 'cp_id_75944' ) {
        $compact_labels = array('Y','M','W','D','H','Mn','S');    //replace this compact labels value with your language     
    }    
    return $compact_labels;    
}
Not the solution you are looking for? Check other articles, or open a support ticket.