Using Code Before & Code After elements

One of the great features from OptimizePress version 2 that we have added to the all new version 3 is the ability to wrap elements in shortcodes or place custom code before or after the elements, sections, and rows. 

NOTE: “Code Before”, and “Code After” is not available for columns due to some strangeness that will happen when the remaining columns will expand to take up the space of the column that might not show up under certain conditions if you are using these for membership content visibility. You can add a row inside of a column though to work around that. 

There are a couple reasons why you might want to use this: 

  • If you want an element to only show to specific users who are logged into your membership site – Many membership plugins have shortcodes that control content visibility. you may use these by placing the first part of the shortcode in the “Code Before Element” and the closing shortcode in the “Code After Element”
  • Placing other code before/after an element in case you need to do so without using a custom HTML element.

All elements including Sections and Rows have this setting in the exact same spot. To find it, simply follow these steps: 

  1. Click on the element to open the element inline toolbar, and then click the gear icon on the right of that toolbar
  2. click the blue “Advanced Options” button
  3. When the advanced options sidebar opens, scroll down and click on “Advanced”
  4. Paste your code in the “Code Before Element” and/or the “Code After Element”

Here is a screenshot to help you visualize where to find the setting: 

Please be careful with the code that you insert here. It is sometimes best to duplicate your page to test it first before using it on a live page to make sure the code you add will not break the editor. We do have some precautions in place for this but we can not prevent all possible bad codes from being entered here and we may not be able to fix it if this happens. 

If you have any questions about this or need any help please reach out to our team and they’ll be more than glad to help with this.

Updated on November 28, 2022

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