wp-bootstrap-navwalker icon indicating copy to clipboard operation
wp-bootstrap-navwalker copied to clipboard

custom icons don't work

Open blatan opened this issue 12 years ago • 10 comments

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

blatan avatar Feb 12 '14 23:02 blatan

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

SideQuestDIY avatar Feb 13 '14 00:02 SideQuestDIY

Great, let me know if I can help you with it. see you

blatan avatar Feb 13 '14 00:02 blatan

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

blatan avatar Feb 25 '14 20:02 blatan

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.

SideQuestDIY avatar Feb 25 '14 22:02 SideQuestDIY

@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?

cristovaov avatar Apr 03 '14 07:04 cristovaov

Hi cristovav, honestly speaking, I don't understand what you're asking me for. Could you clarify?

blatan avatar Apr 03 '14 08:04 blatan

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.

cristovaov avatar Apr 03 '14 09:04 cristovaov

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.

blatan avatar Apr 03 '14 09:04 blatan

Is possible to display only the title attribute when using custom font icons ?

Thank you

mstroiu avatar Feb 06 '15 14:02 mstroiu

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.

pattonwebz avatar Jul 06 '17 14:07 pattonwebz