OptimizePress Compatibility

Over the years, issues have come up in support for several of our themes, with people using a landing page plugin, called OptimizePress. So, if you’re not able to load their “LiveEditor” feature with your Theme Blvd theme, and after contacting their support team, you’ve gotten a response something like this:

These issues normally occur because the theme developer has not properly enqueued (loaded) theme scripts or javascripts into WordPress in the standards compliant way which means we cannot block them from rendering in the LiveEditor and affecting our editor.

… Then, you’ve come to the right place! Let’s fix this.

Understanding the Issue

First of all, let’s understand the issue a bit better. The above statement isn’t quite accurate, but I guess depending on the theme being used (i.e. some other random theme out in the wild, that’s not one of ours) it may or may not be true. In our case, that statement isn’t all that helpful.

In the theme, we separate a lot of functionality for admin and frontend components, in order to give you a more efficiently loading website. In other words, if you’re loading a page on the frontend of your website, you don’t want the bloat of all the PHP code for your theme options page being included. And conversely, if you’re loading your theme options page in your admin, you don’t need all the PHP code for frontend components being loaded there.

However, the OptimizePress plugin’s “LiveEditor” feature calls WordPress default action hooks like wp_head and wp_enqueue_scripts, that are meant only for the frontend of your website, within the admin side of WordPress. The OptimizePress plugin then attempts to remove from your theme and other plugins hooked here, but they don’t take into account all possible priorities, actions can be hooked with.

So, the result here is that some of the theme’s frontend components get included in the WordPress admin, which require other functionality that doesn’t exist. And so obviously, you get PHP fatal errors that occur for undeclared functions and classes.

Fixing the Issue

Luckily, fixing the issue isn’t too difficult. Basically, we just want to make sure anything hooked to those action hooks, that WordPress only normally calls on your website’s frontend, are removed if is_admin() is true.

Below are some fixes for specific themes that people have asked about.

Note: I am not a customer of OptimizePress and I do not personally own the plugin. So, if your theme does not have a fix below, feel free to contact your theme support and we’d be happy to help you to develop a fix for your specific Theme Blvd theme, by logging into your site; then we can add it to our article here, for others. And if any of the fixes below don’t work in the latest version of your theme, also just let us know in support, and we can help you to work it out.

Jump Start

If you’re using Jump Start, add the following to your child theme’s functions.php.

/**
 * OptimizePress Fix: Remove frontend components 
 * from LiveEditor.
 */
if ( is_admin() ) {
	remove_action('wp_enqueue_scripts', 'jumpstart_css', 20);
	remove_action('wp_head', 'jumpstart_su_include_fonts', 5);
	remove_action('wp_head', 'jumpstart_ex_include_fonts', 5);
	remove_action('wp_head', 'jumpstart_ent_include_fonts', 5);
	remove_action('wp_head', 'jumpstart_ag_include_fonts', 5);
	remove_action('wp_enqueue_scripts', 'jumpstart_su_css', 25);
	remove_action('wp_enqueue_scripts', 'jumpstart_ex_css', 25);
	remove_action('wp_enqueue_scripts', 'jumpstart_ent_css', 25);
	remove_action('wp_enqueue_scripts', 'jumpstart_ag_css', 25);
	remove_filter('body_class', 'jumpstart_su_body_class');
	remove_filter('body_class', 'jumpstart_ex_body_class');
	remove_filter('body_class', 'jumpstart_su_body_class');
	remove_filter('body_class', 'jumpstart_ag_body_class');
}

Gnar

If you’re using Gnar, add the following to your child theme’s functions.php.

/**
 * OptimizePress Fix: Remove frontend components 
 * from LiveEditor.
 */
if ( is_admin() ) {
	remove_action('wp_enqueue_scripts', 'gnar_css', 20);
	remove_action('wp_enqueue_scripts', 'gnar_inline_css', 25);
	remove_action('wp_enqueue_scripts', 'gnar_scripts');
	remove_action('wp_head', 'gnar_include_fonts', 5);
	remove_filter('body_class', 'gnar_body_class');
}

Denali

If you’re using Denali, add the following to your child theme’s functions.php.

/**
 * OptimizePress Fix: Remove frontend components 
 * from LiveEditor.
 */
if ( is_admin() ) {
	remove_action('wp_enqueue_scripts', 'denali_css', 20);
	remove_action('wp_enqueue_scripts', 'denali_su_css', 25);
	remove_action('wp_enqueue_scripts', 'denali_scripts');
	remove_action('wp_head', 'denali_include_fonts', 5);
	remove_action('wp_head', 'denali_su_include_fonts', 5);
	remove_filter('body_class', 'denali_body_class');
	remove_filter('body_class', 'denali_su_body_class');
}

Alyeska

If you’re using Alyeska, add the following to your child theme’s functions.php.

/**
 * OptimizePress Fix: Remove frontend components 
 * from LiveEditor.
 */
if ( is_admin() ) {
	remove_action('wp_enqueue_scripts', 'alyeska_css', 20);
	remove_action('wp_enqueue_scripts', 'alyeska_js');
	remove_action('wp_head', 'alyeska_include_fonts', 5);
}

Akita

If you’re using Akita, add the following to your child theme’s functions.php.

/**
 * OptimizePress Fix: Remove frontend components 
 * from LiveEditor.
 */
if ( is_admin() ) {
	remove_action('wp_enqueue_scripts', 'akita_css', 20);
	remove_action('wp_enqueue_scripts', 'akita_scripts');
	remove_action('wp_head', 'akita_include_fonts', 5);
}