PHPackages                             mindkomm/theme-lib-icons - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mindkomm/theme-lib-icons

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mindkomm/theme-lib-icons
========================

Collection of icon sprite helper functions for WordPress themes

1.0.1(7y ago)0361MITPHPPHP &gt;=7.0.0

Since Feb 13Pushed 7y ago3 watchersCompare

[ Source](https://github.com/mindkomm/theme-lib-icons)[ Packagist](https://packagist.org/packages/mindkomm/theme-lib-icons)[ RSS](/packages/mindkomm-theme-lib-icons/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

Icons
=====

[](#icons)

Collection of icon sprite helper functions for WordPress themes.

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require mindkomm/theme-lib-icons
```

Functions
---------

[](#functions)

NameSummaryTypeReturns/Description[get\_icon](#get_icon)Get an icon`string`The HTML to be used in a template.[get\_icon\_url](#get_icon_url)Get the URI to the icon sprite.`string`The URI to the icon sprite. Default `build/icons/icons.svg`[get\_svg\_icon](#get_svg_icon)Return HTML for an accessible SVG icon in an icon sprite.`string`The HTML to be used in a template.[prepare\_html\_tag\_attribute](#prepare_html_tag_attribute)Turn a value and a name into an HTML attribute.`string`### get\_icon

[](#get_icon)

Get an icon

This function is a wrapper that makes it easier to include an icon by only providing the name of the icon and not the whole path. By adding this function, it’s also possible to use the theme version constant for cache busting.

`get_icon( string $icon_name, string $width, string $height, array $args = [] )`

**Returns:** `string` The HTML to be used in a template.

NameTypeDescription$icon\_name`string`The slug of the icon.$width`string`Width in pixel the icon should be displayed at.$height`string`Height in pixel the icon should be displayed at.$args`array`Optional. Array of arguments for SVG icon. See get\_svg\_icon() function.**PHP**

```
