Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Category icons instead of user user avatars
Zhaan
✭✭
G'day folks! I'm interested in displaying custom category icons next to every topic, similar to how IndexPhotos works. Is this possible?
I'm not very good at coding, so this is beyond me for now. ><
Any input will be appreciated.
Here's a quick mockup for reference:
0
Comments
This should do the trick:
Now you have an element with the category url code as an identifier that you can style to your liking.
Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
It seems my mockup isn't showing: http://i5.minus.com/jk41SRlzssRFY.png
@kasperisager Thanks a lot, I'll play around with that!
at the same time you Kasper posted above, I was testing this.
add this to your themehooks.
tested on 2.1
add your various "category" pngs to
your theme's design/images folder
e.g. if your categories are general and tech
create a general.png and a tech.png
for 2.0.18.4 use
it's tedious doing things for multiple versions of vanilla.
if you want the same routine for both controllers, you could point it to the same function as kasper showed.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
That is just pure genious @peregrine!
Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
thx. Kasper - you are the theme genius, mine was just a tad tedious.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
That's the cool thing about your solution: In the long run, it's not tedious at all as it allows for simply dropping a
.png
in a folder and voilá - you've got yourself a category icon. I'm doing somewhat the same here (the parent category icon and label) using CSS pseudo elements and it kinda sucks having to edit the CSS each time a new category is added - simply adding a new.png
to a folder would be a lot easier.Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
I hate sounding like a newb (I totally am one), but where exactly do I place your code, @peregrine? Not familiar with themehooks..
you create one in your theme.
take a look at embedfriendly theme - you will see an example.
name the file in a similar way in your own theme.
class.YourThemethemehooks.php
also search for the word themehooks in the search box - I think I already explained and so did kasper in a recent discussion.
If you still have questions after searching - come on back.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
themes/Zhaan/class.zhaanthemehooks.php
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Hum, I followed the instructions above, but it's not working so far.. I'm using the Ozone theme, by the way. None of my icons are showing yet.
It should be class.ozonethemehooks.php, right?
you need to follow a few steps of debugging and that's going to require you to spend some time learning php coding basics. I suggest you look at a php tutorial on the web.
some things you could do:
a) You could try doing it again
b) repeat the steps but add to embedfriendly theme , and see if it works.
c) echo "some Hellos to see if you can get some new output from you function";
to test, change
post all of your code, changes, and show what files you added and where.
or you can try find a local developer where you live that you can pay to help you beyond this.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
also this should match the directory name of your theme
class ZhaanThemeHooks implements Gdn_IPlugin {
as well as the name of the themehooks file
class.Zhaanthemehooks.php
also match the upper and lower case in the proper places as given in my example.
also make sure to edit your categor-urls in category in dashboard to make sure they match the name of your category.png files that you created.
Zhaan - Probably I need to end here as far as answering questions - because I've done just about everything short of typing the code in on your server. and clicking the upload button from your keyboard.
good luck on your mission.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
As an FYI: Category icons are a feature of 2.1.
@Todd Hum, I see no such option on my 2.1 test site. Is it not present in the current github version?
@peregrine Your solution finally works for me, but the icons are being displayed above thread titles, rather than next to them. What's the easiest way to fix this?
Category icons are available in the beta branch
Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
I take it that's not available for the public yet? My install is very recent, after all.
You can checkout the beta branch here: https://github.com/vanillaforums/Garden/tree/release/2.1b1
Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
Ah, looks like I'm using 2.1a34. Thanks!
Upgraded to 2.1b1, but none of the icons I upload show up anywhere on the site. Am I missing something here?
What layout are you using? Modern? Table?
Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub