Site logo

Archived topic

Menu Icons Plugin Using woff2 instead of SVG

30 replies · Started by Oisin on October 19, 2019

Viewing posts 1–15 of 31

Hi there,

I am getting the Ensure text remains visible during webfont load message for my website in PageSpeed Insights. I have set all icons to load as SVG in the theme settings. Am I missing a trick here?

Thanks,

Johnny.

Hi there,

the SVG Icons in GP only apply to those built into the Theme. It doesn't apply to any that are loaded via another plugin.

Ah yes, it's coming from the menu-icons plugin: /wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/css/types/fontawesome-webfont.woff2?v=4.7.0

I can't see any @font-face rule in there to add font-display: swap; I assume this is because icons are being loaded but I'm not sure. Is there some way to add swap or maybe some other technique to remove the "Ensure text remains visible during webfont load" diagnostic message?

Not unless the plugin author included a filter for that which i would doubt.
Personally would be better to look at an SVG solution to display the icons, instead of loading the entire FA icon library for a couple of menu icons.

The menu item label supports HTML so you can add an img / svg directly to the label.

Cheers David,

Really appreciate the advice. I'm not much a developer and still learning. Is the type of change that requires me to set up a child theme or can I use the additional CSS field?

I found this article that seems to deal with the issue - http://eoinodwyer.com/blog/svg/adding-svg-icons-to-the-wordpress-menu/ - is this the type of thing that will work?

No child theme needed for svg as David mentioned that

The menu item label supports HTML so you can add an img / svg directly to the label.

Thanks Leo, is there something I can follow in the documentation to implement this? Is it easy to do?

Thanks Leo,

I tried adding a test SVG for the Facebook icon in the primary nav. Do you have any idea why it's not working? It's coming back with a 404 error.

I added this to the navigation label - <(img src="https://www.mywebsite.com/wp-content/uploads/2019/11/facebook-f-brands.svg" alt="Facebook Profile" )/>

***Disregard the brackets***

I'm not seeing this in your live site?

That was just an example just to make sure I added the tag correctly. My website is Loadlabz.com

Which menu item has the svg added?

To the right of the contact link in the primary nav there should be a Facebook SVG

Not seeing it in the HTML.

Can you copy and paste the code you've added in the menu label?

Make sure to highlight it and click and code button in the editor here.

This archived topic is closed to new replies.