Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/amund/wp-svgstore/archive/refs/heads/main.zipwp-svgstore is a WordPress plugin that compiles a collection of SVG files into a single file and injects it into the footer of your website for efficient use of SVG icons.
Features
- Combines multiple SVG files into a single sprite file.
- Automatically injects the sprite file into the footer of your website.
- WP-CLI commands to create, check the existence of, and remove the sprite file.
Installation
-
Add repository to your
composer.jsonfile:{ "repositories": [ { "type": "vcs", "url": "https://github.com/Amund/wp-svgstore.git" } ] } -
Run the following command to install the plugin:
composer require amund/wp-svgstore -
Download the plugin and place it in the
wp-content/mu-pluginsdirectory of your WordPress installation. -
Activate the plugin through the "Plugins" menu in the WordPress admin dashboard.
Usage
Via WordPress Interface
The plugin automatically injects the SVG sprite file into the footer of your website. You can use the SVG icons by using the svgstore::icon($id) function, where $id is the identifier of the icon.
Via WP-CLI
The plugin supports the following WP-CLI commands:
wp svgstore create: Creates or updates the SVG sprite file in the template directory.wp svgstore exists: Checks if the SVG sprite file exists in the template directory.wp svgstore remove: Removes the SVG sprite file from the template directory.