Dashicons in wordpress (frontend) won't display

10,781

Solution 1

Dashicons is the official icon font of the WordPress admin as of 3.8..

To load Dashicons for non logged in users:

  1. Open directory {your-website-folder/wp-content/themes/}
  2. Go into the folder of your active child theme ( if you don't have active child theme, open the folder of your active parent theme )
  3. Find there functions.php file and add the provided code at the end of it ( make sure, there isn't ?> php closing tag at the end of file. if so, just remove it ):

    function ww_load_dashicons(){
        wp_enqueue_style('dashicons');
    }
    add_action('wp_enqueue_scripts', 'ww_load_dashicons');
    
  4. Save changes. Dashicons will loads on your website for all users.

EDIT: there may be some plugin/code, which removed Dashicons from pages. Try to change your code with this one:

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

Solution 2

Try this:

<span class="bx-next dashicons dashicons-arrow-right-alt2"></span>

'dashicons-arrow-right-alt2' is the class of the icon. You can find them here: https://developer.wordpress.org/resource/dashicons/#arrow-up-alt

This has to go to your functions.php file:

function load_dashicons(){
    wp_enqueue_style('dashicons');
}
add_action('wp_enqueue_scripts', 'load_dashicons');
Share:
10,781
Admin
Author by

Admin

Updated on June 26, 2022

Comments

  • Admin
    Admin almost 2 years

    Currently, I'm busy creating a website in WordPress. I'm using dashicons for rating ( manualy ) holidays. It used to work, but after update the dashicons won't be visible for non-logged in users. Only, if you login, you can see the star ratings.

    The star rating should be visible on the left top of each holiday deal.

    Who knows a solution?

    Website url is www.ikwilopvakantie.nl

  • Admin
    Admin about 6 years
    Hi The code is already in my functions.php file (i already added this). But still the same issue...
  • Admin
    Admin about 6 years
    Humm still nothing, i see the square signs instead of the star dashicon...
  • Samvel Aleqsanyan
    Samvel Aleqsanyan about 6 years
    you have some cache plugin in your website. clear all cache from plugin, also, clear cache from browser
  • Admin
    Admin about 6 years
    Yep, i deleted all cache in website and cloudflare. Im also using firefox private browser with the setting to don't cache websites... But nothing happens... Do you still see the squares of do you see the stars (top left of a block)
  • Samvel Aleqsanyan
    Samvel Aleqsanyan about 6 years
    your cache plugin is still active. delete all cache and deactivate it/remove all settings. can you confirm, that the provided code still in the functions.php file of active theme?
  • Xarcell
    Xarcell over 5 years
    I am having the same problem in version 5.0.
  • Samvel Aleqsanyan
    Samvel Aleqsanyan over 5 years
    @Xarcell did you try provided answer?
  • Xarcell
    Xarcell over 5 years
    My problem was I was using my own HTML, and forgot to add the dashicons font-family to it.