Developer guidesTemplates and snippets

Templates and snippets

Every template and snippet in the Easy SVG dev setup: what it is for, when to take it, the switch it needs and the command that starts it.

The Easy SVG dev setup is a free GitHub repository with code to copy into client work. Every hook, function and command in it exists in Easy SVG 5.0 and Easy SVG Pro 1.0. tools/check-hooks.php proves it again for the versions you run. License: GPL-2.0-or-later.

Get the code

Three ways, pick the one that fits.

curl -sL https://github.com/unleash-wp/easy-svg-dev-setup/archive/refs/heads/main.tar.gz \
  | tar -xz --strip-components=2 easy-svg-dev-setup-main/templates/icon-pack-plugin

You get the folder icon-pack-plugin/ and nothing else. Replace the last part with any folder under templates/.

Before you ship: rename the acme prefix and the text domain to your own. The switches named below are under Easy SVG → Settings → Features.

Templates

Each template renders through easy_svg_icon() from the free plugin. A page keeps its icons when Pro is deactivated, as long as they come from the free library.

Icon pack plugin

A plugin that carries your icons. Each folder under icons/ is one collection, named by its manifest.json. This is the same layout Pro writes when it exports collections as a plugin.

Take it when you hand the same icons to several sites, or want them in Git and Composer. Switch: Collections.

curl -sL https://github.com/unleash-wp/easy-svg-dev-setup/archive/refs/heads/main.tar.gz \
  | tar -xz --strip-components=2 easy-svg-dev-setup-main/templates/icon-pack-plugin

Open the template, then read the manifest and Build your pack.

Theme

assets/icons/ with three icons and a manifest.json, plus functions-easy-svg.php with a helper acme_theme_icon() and a second folder registered from code. With Pro, the theme folder is read by itself, child theme over parent.

Take it when the icons belong to one theme. Switch: Collections (the free plugin alone prints only its own library).

curl -sL https://github.com/unleash-wp/easy-svg-dev-setup/archive/refs/heads/main.tar.gz \
  | tar -xz --strip-components=2 easy-svg-dev-setup-main/templates/theme

Copy assets/icons/ into your theme and require_once the PHP file from functions.php. Open the template.

PHP-only block

A block written in PHP only, with an icon picker in its sidebar. WordPress draws the sidebar from the attributes; Pro turns the attribute marked 'unleashwp' => array( 'component' => 'icon' ) into a picker.

Take it when you want a block without JavaScript or a build step. Switch: PHP-only blocks.

curl -sO https://raw.githubusercontent.com/unleash-wp/easy-svg-dev-setup/main/templates/php-only-block/acme-feature-block.php

Open the template and the guide PHP-only blocks.

JavaScript block

The block acme/badge: IconControl in the sidebar, IconToolbarButton in the toolbar, both from window.EasySvgPro. Plain script, no build. Without Pro the sidebar falls back to a text field.

Take it when your block needs JavaScript and you do not want a build. Switch: PHP-only blocks (it covers JavaScript blocks too).

curl -sL https://github.com/unleash-wp/easy-svg-dev-setup/archive/refs/heads/main.tar.gz \
  | tar -xz --strip-components=2 easy-svg-dev-setup-main/templates/javascript-block

Open the template and the guide JavaScript blocks.

JavaScript block in JSX

The same block with block.json, render.php and @wordpress/scripts. It imports from @unleash-wp/easy-svg-pro; webpack.config.js maps that import to Pro's script on the page, like @wordpress/components maps to wp.components. Nothing is downloaded from npm for it. easy-svg-pro.d.ts gives your editor autocomplete. The built build/ folder is committed, so it runs as it is.

Take it when your blocks use JSX and block.json. Switch: PHP-only blocks.

curl -sL https://github.com/unleash-wp/easy-svg-dev-setup/archive/refs/heads/main.tar.gz \
  | tar -xz --strip-components=2 easy-svg-dev-setup-main/templates/javascript-block-jsx
cd javascript-block-jsx && npm install && npm run build

Open the template.

ACF and Secure Custom Fields

A field group with ACF's own Icon Picker field and the tab easy_svg, plus acme_acf_icon() that prints the stored value under either return format. Needs ACF 6.3 or newer.

Take it when a client edits icons in ACF fields. Switch: ACF (or Secure Custom Fields).

curl -sO https://raw.githubusercontent.com/unleash-wp/easy-svg-dev-setup/main/templates/acf/acf-icon-field.php

Open the template.

Meta Box

A meta box with a field of type easy_svg_icon. The field stores the icon address as plain post meta. The file shows both readers: rwmb_meta() gives the address, rwmb_the_value() prints the icon.

Take it when the site uses Meta Box. Switch: Meta Box.

curl -sO https://raw.githubusercontent.com/unleash-wp/easy-svg-dev-setup/main/templates/metabox/metabox-icon-field.php

Open the template.

Elementor

A widget of your own with a normal Controls_Manager::ICONS control. Nothing in it is Easy SVG specific: with the switch on, every icon control gets one tab per collection, and Icons_Manager::render_icon() prints the inline SVG. Two files, because the widget class may load only once Elementor is there.

Take it when you build Elementor widgets. Switch: Elementor.

curl -sL https://github.com/unleash-wp/easy-svg-dev-setup/archive/refs/heads/main.tar.gz \
  | tar -xz --strip-components=2 easy-svg-dev-setup-main/templates/elementor

Open the template.

WPBakery

An element of your own with a param of type easy_svg_icon, and the shortcode that draws it. The shortcode is registered even with the switch off, so a saved page never prints its tag as text.

Take it when the site is built with WPBakery. Switch: WPBakery.

curl -sO https://raw.githubusercontent.com/unleash-wp/easy-svg-dev-setup/main/templates/wpbakery/wpbakery-icon-element.php

Open the template.

Snippets for Easy SVG (free)

One file per hook or function. Get any of them with curl -sO https://raw.githubusercontent.com/unleash-wp/easy-svg-dev-setup/main/ followed by the path in the first column, then put it into wp-content/mu-plugins/.

FileWhat it doesTake it when
snippets/free/render-an-icon.phpEvery argument of easy_svg_icon(): label, size, class, decorativeYou print icons in templates. Template code, no plugin header
snippets/free/filter-icon-markup.phpAdds a class to every library icon, and serves a collection acme/<slug> from a theme folder without ProYou change icons on their way out
snippets/free/filter-registrable-icons.phpHides every icon whose slug starts with wip- from the Icon blockYou decide what the Icon block offers
snippets/free/sanitizer-allow-list.phpAllows feDropShadow and one more attribute; remote references only behind a constantAn icon set needs an element the sanitizer drops
snippets/free/upload-limits.phpRaises the size limit to 5 MB and the use limit to 2000A site uploads large drawings
snippets/free/write-stored-icons.phpNew drawing and new name for a stored icon, without wp_update_post()You change library icons from code
snippets/free/addon-sanitizer.phpCleans SVG with the site's own sanitizer and limitsYour plugin accepts SVG from users
snippets/free/panel-extension.phpA tab and a script of your own in the Easy SVG screensYou build an add-on for the admin screens

Snippets for Easy SVG Pro

FileWhat it doesTake it when
snippets/pro/register-collection.phpA collection from a folder, and one from inline markupIcons live in your code, not in a pack
snippets/pro/source-folders.phpAdds a folder, raises the icon and file limits, renames the theme collectionYou load folders from outside the theme
snippets/pro/registered-icon.phpThinner strokes for one collection in the Icon blockYou change what the Icon block draws for Pro collections
snippets/pro/icon-set-events.phpRuns code before and after every save of an icon setA cache or deploy needs to know a set changed
snippets/pro/import-and-configurator.phpRaises the ZIP and font import limits; refuses one more tag in the configuratorImports are bigger than the defaults
snippets/pro/abilities.phpCalls the ability easy-svg-pro/list-icons from PHPYour code or an AI agent searches icons
snippets/pro/abilities.mdEvery ability with its HTTP method, and which switch it needsYou connect an AI client
snippets/pro/wp-cli.mdEvery wp easy-svg command with its outputYou script deploys or CI

Guides and tools in the repository

PathWhat it is
docs/icon-packs.mdThe manifest, a security checklist for packs you share, and the license rules for other people's icons
docs/rollout.mdOne pack, Easy SVG and Pro on many client sites with Composer, wp-config.php and WP-CLI aliases
tools/check-pack.phpChecks a pack folder without WordPress: scripts, external references, entities, size, names, license fields
tools/build-pack.shChecks every folder of a pack plugin and only then writes the ZIP
tools/check-hooks.phpReads the plugins' source and fails when a snippet names a hook, function or constant that is not there
php tools/check-pack.php templates/icon-pack-plugin/icons/starter-shapes
bash tools/build-pack.sh templates/icon-pack-plugin dist

build-pack.sh prints the path of the ZIP it wrote, here dist/acme-icons.zip.

Next