Using and displaying WordPress Dashicons effectively on your website.

How to Use and Display WordPress Dashicons on the Website

One of the easiest ways to change the appearance of a WordPress website is by changing its theme, but finding the right theme can be time-consuming. WordPress Dashicons, which are font icons available from version 3.8, are a lightweight and customizable option for spicing up your site without impacting page load speed. This article explains how to enable and use Dashicons in WordPress, including adding them to menu items, creating custom icons, adding them to custom post types, and disabling them when not in use. Dashicons are a useful feature for enhancing visual design on a WordPress site.

How to Use and Display WordPress Dashicons to Make Your Theme Stand Out

One of the easiest ways to change your WordPress website’s appearance is by changing its theme. However, searching for the right theme can take a long time, so changing it frequently to freshen up your site isn’t the most efficient solution.

This is where WordPress Dashicons can come in handy.

Dashicons are the official WordPress font icons available from version 3.8. They’re scalable, lightweight, and customizable using CSS. For this reason, you can use Dashicons without affecting your site’s page load speed.

What Is WordPress Dashicons?

WordPress Dashicons is a set of font icons included in WordPress core since version 3.8. Over 300 font icons in the SVG format are ready to use without loading a third-party icon library. These font icons are scalable and lightweight – perfect for spicing up your website’s design without hurting its page speed.

See also  Top 5 recommended WordPress plugins for 2020

How to Use and Display Dashicons in WordPress

The Dashicons library is available in your WordPress admin dashboard by default. However, you must enable Dashicons manually if you want to add icons to your theme.

Enabling Dashicons on WordPress Site

  1. Navigate to AppearanceTheme File Editor on your WordPress admin area.
  2. Open the functions.php file.
  3. Add the following code snippet at the bottom of the Functions files:

add_action( 'wp_enqueue_scripts', 'load_dashicons_front_end' ); function load_dashicons_front_end() { wp_enqueue_style( 'dashicons' ); }

  1. Select Update File. You can now use Dashicons on the front end of your WordPress site.

Finding Dashicon HTML and CSS Codes

After enabling Dashicons for your site’s front end, you can add icons to posts, pages, or parts of your theme. Here’s how you can add Dashicons to the menu items:

  1. Access the Dashicons icon library on the WordPress Developer Resources. Click on your chosen icon, hit the Copy HTML link, and copy the Dashicons HTML code from the popup window.
  2. Go to AppearanceMenus from your WordPress dashboard. Click on the menu item to expand the dropdown menu and paste the HTML code into the Navigation Label textbox before the text.
  3. Click Save Menu. Follow these steps for other menu items you want to modify.

Creating Custom Icons With Dashicons

The Dashicons project stopped accepting icon requests in 2020. Therefore, the only way to create a custom icon is by modifying it using CSS code. Here’s an example of a code snippet to resize and change the color of a Dashicons:

.dashicons { 
font-size: 50px; 
width: 50px; 
height: 50px; 
color: blue;
}

Adding Dashicons to WordPress Custom Post Types

WordPress custom post types appear inside the admin menu. Like other menu items, a custom post type has an icon next to it. Adding Dashicons to your custom post types can improve the visual appeal of your admin dashboard.

See also  Creating an online store with Flatsome theme - Customizing for WooCommerce.

If you have any questions about WordPress Dashicons, feel free to leave a comment below.

Conclusion

Dashicons are a useful feature that saves you the hassle of unnecessary images. The icons are lightweight, easy to embed, and have native WordPress support. While it’s not for front-end use, you can fix it by enabling it manually with coding.

Explore the different ways to use Dashicons in WordPress and enhance your website’s design effortlessly.

5/5 - (2 votes)

Related posts