Document Assets

Enqueue custom scripts and stylesheets on a per-document basis or globally across your entire site — all from inside Cornerstone without touching a plugin or functions.php.

  1. Accessing Document Assets
  2. Scripts
  3. Stylesheets
  4. Download Remote
  5. Asset Priority
  6. Disabling Document Assets

@since Cornerstone 7.9.0+

Document Assets lets you attach external scripts and stylesheets directly to any Cornerstone document (page, template, header, footer, etc.) through a dedicated Custom Assets panel in the builder. A matching panel in Theme Options enqueues assets globally across every page of your site.

Accessing Document Assets

Per-Document (page, layout, or component settings)

Open any document in Cornerstone. In the builder's document settings panel, scroll to the Custom Assets group.

Document Assets in Document

Global (Theme Options)

From the Cornerstone dashboard, go to Theme Options and open the Custom Assets module. Assets added here are enqueued on every page of your site.

Document Assets in Theme Options

Scripts

Each script entry is registered and enqueued via WordPress's wp_enqueue_script() and supports the following fields:

Source URLThe full URL of the script file to load.
Handle / IDA unique WordPress script handle. If left blank, a handle is auto-generated (cs-doc-script-0, etc.). Use a handle to target this script with wp_script_add_data() or to declare it as a dependency elsewhere.
TypeSets the type attribute on the <script> tag. Choose Default (no attribute) or Module (type="module").
DependenciesComma-separated list of handles that must load before this script (e.g. jquery, my-other-script).
VersionA version string appended as a query parameter for cache-busting (e.g. 1.2.0). Leave blank to omit.
AsyncAdds the async loading strategy. The script downloads in parallel with parsing and executes as soon as it is available.
DeferAdds the defer loading strategy. The script downloads in parallel with parsing and executes after the document is parsed.
No ModuleAdds the nomodule attribute. Useful for serving fallback scripts to browsers that do not support ES modules.
Load in FooterWhen enabled (default), the script is output before </body>. Disable to place it in <head>.
FieldDescription
Document Assets Scripts

Example: loading an ES module with a fallback

Add two entries:

  1. src → your module URL, TypeModule
  2. src → your legacy bundle, No Module → enabled

Browsers that support ES modules will load entry 1 and ignore entry 2; older browsers do the opposite.


Stylesheets

Each stylesheet entry is registered via wp_enqueue_style() and supports:

Source URLThe full URL of the stylesheet or resource to link.
Handle / IDA unique WordPress style handle. Auto-generated if blank.
RelSets the rel attribute on the <link> tag.
FieldDescription

Rel options:

stylesheetStandard stylesheet — loaded and applied immediately (default).
preloadHints the browser to fetch the resource early without applying it. Pair with an onload attribute or a second <link rel="stylesheet"> entry.
prefetchLow-priority hint to fetch the resource for a likely future navigation.
modulepreloadPreloads an ES module and its dependencies.
alternateAlternate stylesheet (e.g. a print or high-contrast variant).
ValueUse case
Document Assets Stylesheets

Download Remote

The Download Remote button will take any external URL resource and place that file into your uploads folder. Plenty of JS and CSS libraries will give you a CDN URL and with this feature you can serve the files yourself.

Asset Priority

When multiple sources provide assets for a page, they are enqueued in this order:

  1. Global — assets defined in Theme Options → Custom Assets
  2. Document — assets attached to the current page or template
  3. Component — assets from any Cornerstone components used by that document (collected recursively)

Later entries in each list are enqueued after earlier ones, but standard WordPress dependency resolution applies — scripts with declared dependencies always load after their deps regardless of order.


Disabling Document Assets

If you need to disable the entire feature, add the following to your theme's functions.php:

add_filter( 'cs_document_scripts_enabled', '__return_false' );

See something inaccurate? Let us know