wp-icon-picker
wp-icon-picker copied to clipboard
Usage on frontend
Hi, I'm busy with a new field type for Pods that uses this icon picker. All works fine except for frontend forms. Although the loader class doesn't support non-admin pages I did a workaround to enqueue all scripts etc. All modal scripts etc. are also loaded so one would think the icon picker should work fine.
I get the following messages:
Uncaught TypeError: Cannot read property 'selectIcon' of undefined
at HTMLDivElement.g (icon-picker.min.js?ver=0.5.0:1)
at HTMLDocument.dispatch (jquery.js?ver=1.12.4:3)
at HTMLDocument.r.handle (jquery.js?ver=1.12.4:3)
at Object.trigger (jquery.js?ver=1.12.4:3)
at Object.a.event.trigger (jquery-migrate.min.js?ver=1.4.1:2)
at HTMLDivElement.<anonymous> (jquery.js?ver=1.12.4:3)
at Function.each (jquery.js?ver=1.12.4:2)
at a.fn.init.each (jquery.js?ver=1.12.4:2)
at a.fn.init.trigger (jquery.js?ver=1.12.4:3)
at icon-picker.min.js?ver=0.5.0:1
The error below is only when you click on Select icon
Uncaught TypeError: Cannot read property 'frameTitle' of undefined
at n.initialize (icon-picker.min.js?ver=0.5.0:1)
at n.e.View (backbone.min.js?ver=1.2.3:1)
at n.constructor (wp-backbone.min.js?ver=4.9.3:1)
at n.constructor (media-views.min.js?ver=4.9.3:1)
at n [as constructor] (backbone.min.js?ver=1.2.3:1)
at n [as constructor] (backbone.min.js?ver=1.2.3:1)
at n [as constructor] (backbone.min.js?ver=1.2.3:1)
at new n (backbone.min.js?ver=1.2.3:1)
at e (icon-picker.min.js?ver=0.5.0:1)
at HTMLAnchorElement.c (icon-picker.min.js?ver=0.5.0:1)
Found the issue.
Icon_Picker::init()
is called on the wp_loaded
action. When I change it to the init
action it all works fine!