View difference between Paste ID: gavzf7bz and v3iMcG1k
SHOW: | | - or go back to the newest paste.
1
		add_action( 'woocommerce_after_shop_loop_item_title','wpgenie_show_counter_in_loop',50 );
2
3
		function wpgenie_show_counter_in_loop(){
4
5
			global $product;
6
7
			$time = '';
8
9
			if(!isset ($product))
10
				return;
11-
			if('lottery' != $product->product_type)
11+
			if('lottery' != $product->get_type())
12
				return;
13
14
			$timetext = __('Time left', 'wc_lottery');
15
16
			if(!$product->is_started()){
17
				$timetext = __('Starting in', 'wc_lottery');
18
				$counter_time = $product->get_seconds_to_lottery();
19
			} else{
20
				$counter_time = $product->get_seconds_remaining();
21
			}
22
23
			$time = '<span class="time-left">'.$timetext.'</span>
24
			<div class="lottery-time-countdown"
25
			data-time="'.$counter_time.'"
26-
			data-lotteryid="'.$product->id.'" data-format="'.get_option( 'simple_lottery_countdown_format' ).'"></div>';
26+
			data-lotteryid="'.$product->get_id().'" data-format="'.get_option(
27
			'simple_lottery_countdown_format' ).'"></div>';
28
29
			if($product->is_closed()){
30
				$time = '<span class="has-finished">'.__('Lottery finished','wc_lottery').'</span>';
31
			}
32
			echo $time;
33
		}

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×