The "dashicons" control

Learn how to create controls using Kirki

Back to Controls

Returnsstring

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

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>
Edit this page