Today I Learned - Rocky Kev

TIL Dashicons - WordPress' Official Icon Font

POSTED ON:

TAGS:

WordPress has their own Icon Font.

Here it is:
https://developer.wordpress.org/resource/dashicons/#smiley

Usage:

function wpdocs_add_my_custom_menu() {
// Add an item to the menu.
add_menu_page(
__( 'My Page', 'textdomain' ),
__( 'My Title', 'textdomain' ),
'manage_options',
'my-page',
'my_admin_page_function',
'dashicons-admin-media'
);
}

<h2 class="dashicons-before dashicons-smiley">A Cheerful Headline</h2>

<h2><span class="dashicons dashicons-smiley"></span> A Cheerful Headline</h2>

The future

Dashicon might not be fully replaced, but they will be using SVGs in the future.

In an effort to move things forward, and per discussion in the core design chat (link requires registration), it was suggested that an ultimate release of Dashicons be made, to wrap up existing requests (adding 36 new icons), close down to new requests, and to focus future efforts on the new Icon component.

Via https://make.wordpress.org/design/2020/04/20/next-steps-for-dashicons/


Related TILs

Tagged:

TIL Static Blocks vs Dynamic Blocks

A static block is a piece of content whose markup is known when the page is saved. The block saves its content and markup directly in the post content. A dynamic block is a piece of content whose markup and exact content are not known when the page is saved.

TIL how to convert a shortcode to a WP block

Traditionally, shortcodes were a way that plugin developers could provide users the ability to add specific plugin functionality anwhere on their site. But shortcodes are not very user friendly, nor was hunting down the relevant data you needed to render the correct data for the shortcode. Converting existing shortcodes to blocks provides a much greater user experience in all aspects.

TIL how WordPress does serverside

This isn't fully accurate, but for the means of describing server-side rendering, it's a good start!