420 posts
  • Trendsetter
  • Author Level 5
  • Football Player
  • Beta Tester
+5 more
Patchesoft
says

Howdy! I am trying to style the default WordPress widgets that use lists such as New Comments and Archives and Categories. I want to use the Bootstrap icons for the list items and I was wondering how I go about doing this?

I can target the lists using #widget ul li {} but how do I apply the icons to the list from the Bootstrap settings. The icons have class names like icon-comment and to use them you have to use:

<i class="icon-comment" />

Is there a way to apply the icons to the list elements? I could recreate the widgets and insert the icons like that, but that doesn’t seem the most efficient way. Any help?

709 posts
  • Affiliate Level 2
  • Author Level 5
  • Beta Tester
  • Collector Level 2
+2 more
ChillThemes
says

If it was an icon font you could use :before pseudo-element to do that.

420 posts
  • Trendsetter
  • Author Level 5
  • Football Player
  • Beta Tester
+5 more
Patchesoft
says

Ah yeah that doesn’t work. I tried

.main-sidebar-widget li:before { content: "<i class="icon-search" />"; }

And all it will output is the text XP

709 posts
  • Affiliate Level 2
  • Author Level 5
  • Beta Tester
  • Collector Level 2
+2 more
ChillThemes
says

Of course that won’t work, would be nice if it were that simple. You have to use character codes, for example:

content: "\00d7";

You would have to buy Glyphicons pro to get access to the icon font, or use font-awesome.

A Whole Bunch of Amazing Stuff Pseudo Elements Can Do

by
by
by
by
by
by