In order to have the fastest loading landing pages, sales pages, and other pages, we disable most 3rd party plugin/theme scripts when using the Blank OptimizePress template.

Usually, these can be enabled by following instructions in this article.

But, if 3rd party plugin is using a unconventional handle or way to enqueue their scripts, we added a few helpful filters to allow 3rd party developers to whitelist their scripts or styles.

Scripts

The filter for scripts is:

return apply_filters('op3_script_is_allowed_in_blank_template', false, $handle);

Below is an example usage of the above:

// Paid Membership Pro fix for Stripe
if (defined('PMPRO_VERSION')) {
    add_filter('op3_script_is_allowed_in_blank_template', [$this, 'allowPmproScripts'], 10, 2);
}

And the code inside allowPmproScripts is below:

public function allowPmproScripts($value, $handle)
    {
        if ($handle == 'stripe') {
            return true;
        }

        return $value;
    }

As you can see, the method uses a script’s handle and if it is matched, it simply returns true.

Styles

We have a similar filter for Styles as well:

return apply_filters('op3_style_is_allowed_in_blank_template', false, $handle);

And the simple example of usage:

if (class_exists(\AccessAlly::class)) {
    add_filter('op3_style_is_allowed_in_blank_template', [$this, 'allowAccessAllyFrontendStyles'], 10, 2);
    }

And the code inside allowAccessAllyFrontendStyle is below:

public function allowAccessAllyFrontendStyles($value, $handle)
    {
        if ($handle == 'accessally-frontend-styling') {
            return true;
        }

        return $value;
    }

Again, looking for style’s handle and if it is matched, it will return true, thus including the style in the blank template.