1. Home
  2. Knowledge Base
  3. OptimizePress
  4. Frequently Asked Questions
  5. How to add custom scripts to OptimizePress pages

How to add custom scripts to OptimizePress pages

If you need to add external scripts to your OptimizePress 3.0 pages (pages created in our OptimizeBuilder platform), there are a few options:

Add Code to Specific OptimizePress Pages

If you need to add codes on a specific page, you can go to Settings > Page Scripts within the editor and paste your codes here.  This is the best place for external javascript codes – you can choose to add your code in one of 3 pages:

1. Header Script – codes will be addd in the <head></head> section of the page

2. Body Script – these codes will be added within the <body> </body> tags on your page

3. Footer Script – these codes will be added at the end of your page before the close of the <body> tags 

Add Codes Sitewide For All OptimizePress & WordPress Pages

OptimizePress currently does not have a Code Manager as part of the built in features. This means if you want to add code sitewide, then you’ll need to use a 3rd party plugin such as WP Code (formerly named “Insert Headers and Footers”)

To ensure the plugin can add codes to your OptimizePress pages, go to OptimizePress > Settings > Styles And Scripts and enable the plugin on the Frontend to allow it to render codes to your pages created with OptimizePress.

For example, if you wish to use the WP Code plugin, here is where you would enable the styles and scripts:

To add new codes via the WP Code plugin, you’ll navigate to that plugin in the WP Admin area by looking for and clicking the “Code Snippets” and then “Header & Footer” to easily add the script to the header or footer of all pages.

You can also add other code snippets there in that plugin as well by simply clicking “Add New” after going to the Code Snippets area:

To learn more about using this plugin please refer to the plugin documentation on WordPress.org

Frequently Asked Questions

Why can’t I load the page editor after I add my custom code?
When you add a code through the OptimizeBuilder, we have filters in place to prevent pasting in code that would break the editor. As we use a range of different codes such as jQuery and JavaScript, this means that not all 3rd party or custom codes will work with our builder. If you happen to add code through our builder and then the builder does not work, please reach out to our support team so we can remove the incompatible code for you.

Why did the code I added through WP Code plugin or other similar plugin make the editor not load anymore for the OptimizePress page?
If you add a code to your site through a plugin such as WP Code and find the editor does not work, then you’ll need to rewrite your code or find an alternate code to use as we can not help fix issues with any custom codes added to your site through 3rd party plugins such as WP Code or others.

Updated on March 13, 2023

Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for? Don't worry we're here to help!
Contact Support