Support

Account

Forum Replies Created

  • Hi Simov,
    Find my code. Not sur it’s the cleanest way but it works.
    I use ‘specials’ CPT and i want display them only is the date is valid.

    
    <?php 
    $datedeb = get_field('debut-promo', false, false);
    $datefin = get_field('fin-promo', false, false);
    $today = strtotime(date('Ymd'));
    $promoend = strtotime($datefin);
    $datedeb = new DateTime($datedeb);
    $datefin = new DateTime($datefin);
    ?>			
         <?php if ($promoend >=$today): ?>
              // your code here
         <?php endif; ?>	
    

    Hope that will help you.
    cheers,
    Pierre-Yves

  • Thanks. I was using a wrong date format.

    
    $today = strtotime(date('Ymd'));
    $promoend = strtotime($datefin);
    

    Perfectly works like this. just have to compare $today and $promoend

  • Hi John and thanks for helping.

    Finally found a great plugin. Frontend Gallery Slider For ACF.
    Just fill your ACF gallery name and insert a shortcade in your template file.

    For a few $ (6) you can get the pro version providing more sliders templates and features.

Viewing 3 posts - 1 through 3 (of 3 total)