wpgenie

show flip countdown timer in product archive / loop

Feb 4th, 2022
1,600
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.28 KB | None | 0 0
  1. /* show flip countdown timer in product archive / loop - works only with https://wpgenie.org/product/flip-countdown-timer-for-woocommerce-lottery/ WooCommerce Lottery addon! */
  2.  
  3. add_action( 'woocommerce_after_shop_loop_item_title','wpgenie_show_counter_in_loop_flip', 51 );
  4.  
  5. function wpgenie_show_counter_in_loop_flip(){
  6.  
  7.     global $product;
  8.  
  9.     $time = '';
  10.  
  11.     if(!isset ($product))
  12.         return;
  13.     if('lottery' != $product->get_type())
  14.         return;
  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.     if ( ( $product->is_closed() === FALSE ) && ($product->is_started() === TRUE ) ) : ?>
  24.  
  25.         <div class="tick" data-date="<?php echo $product->get_lottery_dates_to(); ?>"
  26.             data-did-init="handleTickInit">
  27.  
  28.             <div data-repeat="true"
  29.                 data-layout="horizontal center fit"
  30.                 data-transform="preset(h, m, s) -> delay">
  31.  
  32.                 <div class="tick-group">
  33.  
  34.                     <div data-key="value"
  35.                         data-repeat="true"
  36.                         data-transform="pad(00) -> split -> delay">
  37.                         <span data-view="flip"></span>
  38.                     </div>
  39.                     <span data-key="label"
  40.                         data-view="text"
  41.                         class="tick-label"></span>
  42.                 </div>
  43.             </div>
  44.         </div>
  45. <?php
  46.  
  47.     endif;
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment