WordPress Customizer Dashicons Control

Learn how to create a dashicon control using the Kirki Customizer Framework.

Back to Controls

Returnsstring

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', [
	'type'     => 'dashicons',
	'settings' => 'my_setting',
	'label'    => esc_html__( 'Dashicons Control', 'kirki' ),
	'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>

Can't find what you're looking for? Check the github issues or edit this page to add what's missing.