I've created a Text widget and put font-awesome icon HTML in editor Text Mode <i class="fab fa-facebook"></i>
but toggling to Visual mode makes the code disappears though I can see it working on Frontend.
3 Answers
I think the issue is that WordPress removes empty tags from the editor. Try adding in a non-breaking space - Font Awesome should remove it so you shouldn't see any noticeable difference:
<i class="fab fa-facebook"> </i>
You have used the wrong syntax.
True syntax is <i class="fa fa-facebook"></i>
.
Also verify that you have added font-awesome in your theme and function file.
-
Not necessarily. Depends on the Font Awesome version. Font Awesome 5 uses
fab
instead offa
to display brands.– DSofaCommented Jan 29, 2019 at 2:56
@Harsh - The original poster was using the syntax from Font Awesome 5, where different prefixes are used based on whether it is a brand (fab prefix), solid (fas prefix), regular (far prefix) and light (fal prefix).
Also, I found that the " "
did resolve disappearing icon the issue for me.