Snippet types
SnipCraft manages four kinds of code snippet, each suited to a different job.
The four types
- PHP — server-side code that runs as part of the WordPress request cycle.
- CSS — stylesheet rules enqueued through WordPress's asset system.
- JavaScript — scripts enqueued in the document head or footer.
- HTML — markup injected directly into the page output.
How each type runs
PHP snippets execute on the server as part of the normal WordPress request cycle — they run before any output is sent to the browser. This makes PHP the right type for hooks, filters, custom functions, and anything that needs to interact with the WordPress API.
CSS, JavaScript, and HTML snippets are injected into the page output. CSS and JavaScript are enqueued through WordPress's standard asset system and rendered in the document head or footer. HTML snippets are output directly into the page at the appropriate point in the request.
Enabled limits on the free edition
The free edition places no limit on how many PHP snippets you can have enabled at once. However, CSS, JavaScript, and HTML each have a cap of one enabled snippet per type at a time.
- Unlimited enabled PHP snippets
- One enabled CSS snippet
- One enabled JavaScript snippet
- One enabled HTML snippet
Pro
SnipCraft Pro removes all enabled-snippet limits. You can have as many CSS, JavaScript, and HTML snippets enabled simultaneously as you need.Related
Each snippet type runs within a configurable scope that controls whether it executes on the front end, in wp-admin, or both. For features that combine multiple types, see modules.