custom icons don't work
Hi and thanks for the class.
I've found something. I'm using my own font icons.
<a href="#"><span class="icon-doc"></span>Media</a>
I added to the menu:
<span class="icon-doc"></span>Media
It breaks the layout and adds html into tittle atribute.
The problem is in the 105th line and below.
For now I commented 3 first lines and left only:
$item_output .= '<a'. $attributes .'>';
Now it works as I want it to work.
It's to late for me to think about it, but maybe we could find some solution for custom icons? I'm sure the title attribute has to be always escaped.
I'm at your service if I can help you.
Regards, Bernard
Hey Bernard,
This is something I am looking at for the next version of the script. I am thinking of creating a few variables (that you can override) that will adjust how output is rendered.
-Edward
Great, let me know if I can help you with it. see you
Hi Edward,
I've got one small improvement to your code.
I added to my navigation labels html with font icon
<span class="icon-home-1"></span>Home
but I defined Title without html: Home
Your code omits title attribute and thus I got html in the title attributes of the links:
<a title="<span class="icon-home-1"></span>Home" ... >Home
, so I added a fix:
$atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : (! empty( $item->title ) ? $item->title : '' );
Hope this helps.
Regards, Bernard
Thanks for bringing this to my attention, the title attribute is actually used, but only in certain circumstances. I have added it to my list of changes for the next version.
@blatan I've just put up an icon font proposal see #94 -the way it's currently set up it should be work with custom icon fonts too. would you mind having a go at it?
Hi cristovav, honestly speaking, I don't understand what you're asking me for. Could you clarify?
yes sorry @blatan , could you try my fork of the walker with your custom icons (but without your changes)? small instructions in issue 94 mentioned above -we are looking at implementing an easy way of adding icons to menus.
Ok, I'll try testing it asap, but I don't know how long it takes.
In my proposition I can see a bug which can occur. $item->title should be escaped.
Is possible to display only the title attribute when using custom font icons ?
Thank you
This is a very old issue and a discussion about custom icons and their usage is going on in a different thread. In the interest of clearing out older or inactive issues to focus on active ones; I'm closing this for now. Feel free to reopen if this is still an issue.