victor-valencia / bootstrap-iconpicker

A simple icon picker
https://victor-valencia.github.com/bootstrap-iconpicker/
MIT License
377 stars 140 forks source link

Compatible with WordPress? #18

Closed kjbenk closed 9 years ago

kjbenk commented 9 years ago

It seems as though this library is not compatible with WordPress. Is this intentional or is there some special setup I need to do? I was able to get the icon picker to work on a single page html doc, but within WordPress the icon picker is never getting initialized. When I inspect the button DOM element it never gets updated to include the icon picker class or the appended <i> tags. Here is what I see after the page loads:

<button class="btn btn-default" role="iconpicker"></button>

This is the same as the html code I have in my source file. I really like this library and I think its a great addition to the bootstrap button dropdown, so it would be great if it was compatible with WordPress.

Thanks for your help.

kjbenk commented 9 years ago

I think I solved the problem, and it might have to do with how WordPress included javascript files and jQuery. Basically I just had to explicitly call the $('button[role="iconpicker"]').iconpicker(); function in a javascript file that I include on the page I am using the iconpicker. For some reason the real $('button[role="iconpicker"]').iconpicker(); on line 440 was just not being called at the right time.