WordPress websites divide the image to enrich the visualization of the entire presentation, and often use various icon sets such as Font Awesome, Elusive Icons, Genericons, etc., but additional cloud-loaded icon files are required, and even plug-ins are used for convenience. Using icons, coupled with many plug-ins, will often load their own icon groups, which often becomes one of the main sources of slowing down the speed of the website. If you can make good use of the built-in Dashicons icon group, it will help improve your website. overall speed.
Basic introduction to Dashicons📂
Dashicons is a built-in icon group in the core of Wordpress. When you enter the background management interface, you will see various icons in the function bar. However, when browsing in the foreground, if you are an ordinary user who is not logged in, Dashicons will not be automatically loaded. After entering, the icon will not be displayed. At this time, you can use the code snippet (Code Snippet) to load Dashicons to make the website more visually rich.
The following describes how to enable Dashicons in the frontend. Once the frontend is browsed and loaded, you can directly use Dashicons to enrich the website's visuals when writing web pages. Please refer to the official website of Dashicons for usage methods.
Related Reading ▶️Dashicons official website
Loading practices for Dashicons
Method XNUMX: Modify the theme of the scene
Modify the functions.php file of the theme theme, in
add_action( 'wp_enqueue_scripts', 'load_dashicons_front_end' );
function load_dashicons_front_end() {
wp_enqueue_style( 'dashicons' );
}
Method XNUMX: Code management plug-in
Use code snippets (Code Snippet) to manage plug-ins, such as: Code Snippets,WPCodeBoxWait for the plug-in, and choose to add the PHP-type code snippet. Usually, the code snippet management plug-in will be added automatically.
<?php
add_action( 'wp_enqueue_scripts', 'load_dashicons_front_end' );
function load_dashicons_front_end() {
wp_enqueue_style( 'dashicons' );
}
In addition to using code snippets, of course alsoMenu Icons by ThemeIsleWaiting for the plug-in can help load and manage the icon group, but even having to install another plug-in can easily cause the website to slow down or have minor problems when browsing. The graph shows that there is a problem.