Hi,
which plugin are you using for add countdown? You need to re init the script for countdown after each infinite scrolling action. Unfortunately it depends by the scripts you are using.
Let me know, so I can guide you to add the compatibility.
Regards 🙂
Thread Starter
bolzo5
(@bolzo5)
hi,
thanks that would be very helpful,
I’m using woocommerce and its plugin simple auction and the code which adds the timer it’s in the theme function.php and it goes like this.
add_action( 'woocommerce_before_shop_loop_item_title','wpgenie_show_counter_in_loop');
function wpgenie_show_counter_in_loop(){
global $product;
$time = '';
if(!isset ($product))
return;
if('auction' != $product->product_type)
return;
$timetext = __('Time left', 'wc_simple_auctions');
if(!$product->is_started()){
$timetext = __('Starting in', 'wc_simple_auctions');
$counter_time = $product->get_seconds_to_auction();
} else{
$counter_time = $product->get_seconds_remaining();
}
$time = '<span class="time-left">'.$timetext.'</span>
<div class="auction-time-countdown"
data-time="'.$counter_time.'"
data-auctionid="'.$product->id.'" data-format="'.get_option(
'simple_auctions_countdown_format' ).'"></div>';
if($product->is_closed()){
$time = '<span class="has-finished">'.__('Auction finished','wc_simple_auctions').'</span>';
}
echo $time;
}
thank you again for your time!
Hi,
unfortunately it doesn’t depends by php code but by the js script of plugin auctions. Anyway try to use this custom script
jQuery(document).on( 'yith_infs_added_elem', function( ev, elem, current_url ) {
elem.find( ".auction-time-countdown" ).each(function( index ) {
var time = jQuery(this).data('time'),
format = jQuery(this).data('format'),
etext = '';
if(format == ''){
format = 'yowdHMS';
}
if( typeof jQuery.SAcountdown != 'undefined' ) {
jQuery(this).SAcountdown({
until: jQuery.SAcountdown.UTCDate(-(new Date().getTimezoneOffset()), new Date(time * 1000)),
format: format,
onExpiry: closeAuction,
expiryText: etext
});
}
});
});
Let me know if it works or if you don’t know how to add it on page.
Regards 🙂