0

Hello I have here a code that is based on a "where you first access the page you will see the Disclaimer template" but I want it to show every time I refresh the page

<?php 

// DISCLAIMER CHECK
    
$ip = TCG_RETURN_IP();
$disclaimer_option = 'tcg_disclaimer_'.$ip;
$get_disclaimer    = get_option($disclaimer_option);
$date_now   = new DateTime();
$date_now   = $date_now->setTimezone( new DateTimeZone('GMT+1') );


    if( (TCG_CHECK_DISCLAIMER() != false) || (TCG_CHECK_DISCLAIMER() != '') ){

        // if($date_now>$get_disclaimer){
        if($date_now>$get_disclaimer){
            delete_option($disclaimer_option);
            get_template_part('topcitygirls/templates/topcity','disclaimer');
            //get_template_part('topcitygirls/templates/topcity','header');

                echo 'true';
            
        }else{
            get_template_part('topcitygirls/templates/topcity','header');

        }
    }else{
        if( is_user_logged_in() ) {
            get_template_part('topcitygirls/templates/topcity','disclaimer');
        }else{
           $date_expire = clone $date_now;
            $date_expire = $date_expire->add(new DateInterval('PT1H'));
            update_option($disclaimer_option,$date_expire);
            get_template_part('topcitygirls/templates/topcity','header');
           
        }
    }

    get_template_part('topcitygirls/templates/topcity','passwords');
?>
1
  • there won't be a difference between refreshing the page, and simply visiting it a second time in a new tab, is it specifically refreshing you want? Or is this any time anybody visits that page even if they've visited it before? Note that the code you shared here can't be cached and only allows for site-wide expiration, not per user expiration, so it will never work for more than one visitor to your site
    – Tom J Nowell
    Apr 27 at 10:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.