Skip to content

Frontend assets

OctaForms ships exactly one JavaScript file and one stylesheet on the front end, together as one bundle. That bundle contains three things: the form helper, the callback widget, and the cron nudge. Which of them actually does anything depends on the data present on the page, not on which files load. So there is nothing to conditionally enqueue.

  • One JS file and one CSS file, always, on every front-end page.
  • Loaded in the footer with the lowest execution priority, so it never gets in the way of your own scripts.
  • The stylesheet is printed last and loaded asynchronously, so it does not block rendering.
  • Each module inside the bundle activates only when its data is present. The helper looks for octaFormsHelper, the callback widget for octaFormsCallback, the cron nudge for octaFormsCron. If the data is not there, the module stays silent.

Everything can be switched off with a filter, and most also with an admin setting:

What Filter Setting
The whole bundle (JS and CSS) octa_forms_frontend_assets_enabled
The stylesheet only octa_forms_styles_enabled disable_styles
The helper’s automatic form scan octa_forms_helper_autobind
The cron nudge octa_forms_cron_nudge_enabled disable_cron_nudge
The callback widget on a given page octa_forms_callback_visible

A couple of these are worth explaining:

  • octa_forms_callback_visible is a per-request escape hatch. Return false to hide the widget on specific pages, such as a checkout. The bundle still loads; only the widget’s data and markup are left out.
  • octa_forms_helper_autobind is developer-only, with no admin setting. Return false and the helper skips its initial scan, but window.octaForms.attach() still works so you can bind forms yourself. See The JS helper.

To strip the plugin’s front-end code completely, use the master switch octa_forms_frontend_assets_enabled.

All of these filters are listed with their signatures in Hooks and filters.