Forum breadcrumbs – You are here:Asgaros Support ForumSupportCustom Category Icons
Please or Register to create posts and topics.

Custom Category Icons

PreviousPage 2 of 2

You can change the forum-icons in the structure-administration. Just use one identifier of the dashicons-list:

Dashicons

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

These Dashicons are very limited and are focused towards software development use rather than end user viewing.  For example I have a forum called ‘Electronics Group’ (for my members who are interested in electronics) but I can’t find ny suitable icon in Dashicons that reflects ‘electronics’. Yet google shows many hits for ‘svg icon electronics’ searches. It would be really usefull to have a ‘simple’ way to use other icon libraries instead (or as well as) dashicons. Is this a possibility?

As i only have a few forum I could use css code such as
div#forum-category-4 {
background-image: url(https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png);
}
as you have provided above for background images.
But I have no idea as to what code to use to add an category icon (as you have done for ‘statistics’) or a non-dashicon icon my forums.

jimcroisdale has reacted to this post.
jimcroisdale

Hello @ray

Yes, I understand your problem. At the moment I only added support for the dashicons-library because its an icon-library which is included in WordPress by default. I am not a big fan of adding third-party libraries to my plugin because otherwise I have to update Asgaros Forum everytime a new version of those third-party libraries is released (because of security fixes, for example).

Here is another example for an icon:

div#forum-category-4:before {
    height: 32px;
    line-height: 32px;
    padding-right: 5px;
    background-image: url(https://s2.coinmarketcap.com/static/img/coins/32x32/1528.png);
    background-size: 32px 32px;
    background-repeat: no-repeat;
    width: 32px;
}

 

fweinert has reacted to this post.
fweinert
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!
div#forum-category-48 is for 'category id 48' so what is the equivalent for a 'forum'

sorry but
div#forum-category-48:before {
    height: 32px;
    line-height: 32px;
    padding-right: 5px;
    background-image: url(https://s2.coinmarketcap.com/static/img/coins/32x32/1528.png);
    background-size: 32px 32px;
    background-repeat: no-repeat;
    width: 32px;
}
doesn't work for me as there is nothing showing before the category label
but
div#forum-category-48 {
 background-image: url(https://s2.coinmarketcap.com/static/img/coins/32x32/1528.png);;
}
does (so I have the id number correct) - but it only changes the background image by repeating the icon several times.
If I add " background-repeat: no-repeat; " then the repeating stops happening 
but there is no spacing between the icon and my category label so my label text overlaps the icon image.
If I add all the other lines of code except ":before" nothing else changes.
When I add ":before" (to make it the same as your example code) then the icon is not shown at all

any suggestions why ":before" is not working for me?

Hello @ray

The icons for forums can be selected like this:

#forum-123 .forum-status:before {
    /* ... */
}

If you need to adjust the spacing/alignment, you can use the padding/margin attributes, e.g.:

https://www.w3schools.com/css/css_margin.asp

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

ok thanks for your replies

Can someone lay out that code in one go, for a noob like me?

Is 32x32px the size required also?

Jim

No, the code is just an example and depends on the image/icon you want to use and your overall style. So there is not a simple code which you can use – custom modifications are necessary in most of the cases.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!
Quote from Asgaros on April 25, 2018, 10:53 am

Hello @ray

The icons for forums can be selected like this:

#forum-123 .forum-status:before {
    /* ... */
}
  1. #forum-123 .forum-status:before {
  2. /* … */
  3. }
#forum-123 .forum-status:before {
    /* ... */
}

If you need to adjust the spacing/alignment, you can use the padding/margin attributes, e.g.:

https://www.w3schools.com/css/css_margin.asp

I tryit to use this to add fontawesome icon, but do not show the icon.

In the header I add

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">

Then the CSS

#forum-7 .forum-status:before {
    font-family: "Font Awesome 5 Free"; 
    font-weight: 400; 
    content: "\f412";
}

😛

Cheers!

Asgaros and fweinert have reacted to this post.
Asgarosfweinert
PreviousPage 2 of 2