Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Lego2012/c5bb0bbc137526be96d142ee13c0f029 to your computer and use it in GitHub Desktop.
Save Lego2012/c5bb0bbc137526be96d142ee13c0f029 to your computer and use it in GitHub Desktop.

Here’s some relevant notes:

Both outer and canvas:

if ( bricks_is_builder() ) {
}

Only outer (this code won’t run in the inner canvas (your actual Page/template)):

if ( bricks_is_builder_main() ) {
}

There are some snippets that should be run on the Bricks canvas only, like adding outlines in the editor. Here’s the condition for this:

if ( bricks_is_builder() && ! bricks_is_builder_main() ) {
}

On the canvas (the inner frame) & frontend, not the builder panel (outer stuff):

if ( ! bricks_is_builder_main() ) {
}

Only frontend:

if ( bricks_is_frontend() ) {
}

or

if ( ! bricks_is_builder() && ! is_admin() ) {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment