Bypass certain pages from Under Construction Plugin

Hello

Can you please help me out bypassing certain pages from the under construction extension provided in the bundle? Ic couldn’t find any configuration regarding it from it’s settings page.

Thanks!

Hi There,

To achieve that, you have to edit the the output.php file locates under tco-under-construction/functions/ directories.

Find this function:

function tco_under_construction_output( $original_template ) {

  require( TCO_UNDER_CONSTRUCTION_PATH . '/functions/options.php' );

  if ( isset( $tco_under_construction_enable ) && $tco_under_construction_enable == 1 && ! is_user_logged_in() ) {

    if( isset( $_COOKIE['tco_under_construction_bypass'] ) ) {
      return $original_template;
    }

    if ( isset( $tco_under_construction_whitelist ) && !empty( $tco_under_construction_whitelist ) ) {

      $allowed_ips = explode(' ', $tco_under_construction_whitelist);

      if ( in_array( $_SERVER['REMOTE_ADDR'], $allowed_ips) ) {

        return $original_template;

      }

    }

    status_header( 503 );

    if ( isset( $tco_under_construction_use_custom ) && $tco_under_construction_use_custom == 1 ) {
      return tco_under_construction_custom_output( $tco_under_construction_use_custom );
    } else {
      return TCO_UNDER_CONSTRUCTION_PATH . '/views/site/under-construction.php';
    }

  } else {

    return $original_template;

  }

}

And change to this:

function tco_under_construction_output( $original_template ) {

  require( TCO_UNDER_CONSTRUCTION_PATH . '/functions/options.php' );

  if ( isset( $tco_under_construction_enable ) && $tco_under_construction_enable == 1 && ! is_user_logged_in() ) {

    if(is_page( array(12, 34, 56) )){
      return $original_template;
    }

    if( isset( $_COOKIE['tco_under_construction_bypass'] ) ) {
      return $original_template;
    }

    if ( isset( $tco_under_construction_whitelist ) && !empty( $tco_under_construction_whitelist ) ) {

      $allowed_ips = explode(' ', $tco_under_construction_whitelist);

      if ( in_array( $_SERVER['REMOTE_ADDR'], $allowed_ips) ) {

        return $original_template;

      }

    }

    status_header( 503 );

    if ( isset( $tco_under_construction_use_custom ) && $tco_under_construction_use_custom == 1 ) {
      return tco_under_construction_custom_output( $tco_under_construction_use_custom );
    } else {
      return TCO_UNDER_CONSTRUCTION_PATH . '/views/site/under-construction.php';
    }

  } else {

    return $original_template;

  }

}

The 12, 34, 56 numbers should be your page ID. To find the page IDs, please take a look at this:

Hope that helps and thank you for understanding.

Thank you for your reply.

For some reason, I’m unable to scroll down if viewed the bypassed page on a mobile. Also, the bacground image as set in the the plugin is appearing on the bypassed page.
Please have a look here:

https://apex.sddgm.org/registration and

https://apex.sddgm.org/donate/

Hello There,

The under construction page was designed as unscrollable page. To override this, please add the following CSS code in the X > Theme Options > Global CSS (http://prntscr.com/evui3r)

html,
body {
        overflow: visible !important;
        height: auto !important;
}

We would loved to know if this has work for you. Thank you.

Thank you for the answer, however adding the above CSS broke the main page. As you can see here, background image is now unresponsive. But is responsive, in the bypassed pages.

What could be the cause?

Hi @ngrhd,

It needs to be ID specific too, instead of adding that CSS. Please change this code

if(is_page( array(12, 34, 56) )){
      return $original_template;
    }

to this

if(is_page( array(12, 34, 56) )){
echo '<style>
html,
body {
        overflow: visible !important;
        height: auto !important;
}
</style>';
      return $original_template;
    }

Thanks!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.