About Rendro Countdown

I want to make countdown plugin with rendro countdown from https://github.com/rendro/countdown, and this my code:

function dhiscomingsoon_enqueue(){
$plugin_url = plugin_dir_url( __FILE__ );
wp_enqueue_script(‘jquery’);

wp_register_script(‘jquery.countdown.min’,$plugin_url.’assets/js/jquery.countdown.min.js’, array(‘jquery’) );
wp_enqueue_script(‘jquery.countdown.min’);
}

function dhiscomingsoon_footer(){
global $options; $options = get_option(‘dh_iscomingsoon’); ?>

<script type=”text/javascript” language=”javascript”>
jQuery.noConflict();

jQuery(document).ready(function(){
var endDate = “<?php echo $options[‘dhiscs_countdown’]; ?>:00”;

jQuery(‘.countdown’).countdown({
date: endDate,
render: function(data) {
jQuery(this.el).html(“<div>”
+ this.leadingZeros(data.days, 3)
+ ” <span>days</span></div><div>”
+ this.leadingZeros(data.hours, 2)
+ ” <span>hrs</span></div><div>”
+ this.leadingZeros(data.min, 2)
+ ” <span>min</span></div><div>”
+ this.leadingZeros(data.sec, 2)
+ ” <span>sec</span></div>”);
}
});

});
</script>
<?php
}

function dh_iscomingsoon_init(){
// do stuff
if(!is_user_logged_in()) {
add_action(‘wp_enqueue_scripts’,’dhiscomingsoon_enqueue’);
}
}
add_action( ‘init’, ‘dh_iscomingsoon_init’ );

But not work on frontend, if want work i must insert

wp_register_script(‘jquery’,’https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js’);
wp_enqueue_script(‘jquery’);

Can you tell me how to make this work without:

wp_register_script(‘jquery’,’https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js’);
wp_enqueue_script(‘jquery’);

Thankyou…

Read more here:: About Rendro Countdown

Leave a Reply

Your email address will not be published. Required fields are marked *