The "dashicons" control

Learn how to create controls using Kirki

Back to Controls

Returnsstring

The documentation site is currently being rewritten. If you can't find what you're looking for please check the github issues and ask for assistance there until the documentation rewrite is complete.

The dashicons control allows you to select an available icons from the WordPress Dashicons iconfont.

The returned value is a string and does not contain the dashicons dashicons- prefix, and allows you to handle the selected values as you see fit.

Example

<?php
Kirki::add_field( 'theme_config_id', array(
	'type'     => 'dashicons',
	'settings' => 'my_setting',
	'label'    => __( 'Dashicons Control', 'textdomain' ),
	'section'  => 'section_id',
	'default'  => 'menu',
	'priority' => 10,
) );
?>

Usage

<?php $icon = get_theme_mod( 'my_setting', 'menu' ); ?>
<span class="dashicons dashicons-<?php echo esc_attr( $icon ); ?>"></span>
Edit this page