MWDelaney / bootstrap-3-shortcodes

WordPress shortcodes for easier use of Bootstrap elements in your content.
https://wordpress.org/plugins/bootstrap-3-shortcodes/
MIT License
377 stars 118 forks source link

popover.js and tooltip.js enqueued for frontend #92

Closed jag1989 closed 10 years ago

jag1989 commented 10 years ago

As these two files are being enqueued for the front-end and back-end I'm seeing a 'Uncaught TypeError: undefined is not a function'.

As a fix I've done the following:

function dequeue_scripts() { if ( ! is_admin() ): wp_dequeue_script( 'bootstrap-shortcodes-tooltip' ); wp_dequeue_script( 'bootstrap-shortcodes-popover' ); endif; } add_action('wp_print_scripts', 'dequeue_scripts', 100);

As a future update I would recommend updating bootstrap_shortcodes_scripts (line 42 of bootstrap-shortcodes.php v 3.2.4) to check for is_admin, then enqueue the scripts.

MWDelaney commented 10 years ago

These two scripts are required for tooltips and popovers to work (see Bootstrap documentation for details). You can see this issue addressed in #89 and #51.

MWDelaney commented 10 years ago

These scripts should now be conditionally loaded only when the [tooltip] and [popover] shortcodes are in use on a given page. See here: c1131e00b13176947caeb0fbb4286a0605c2c68a

jag1989 commented 9 years ago

I would have thought this would have been merged into 3.3. readme,txt states "Only enqueue tooltip and popover trigger javascript if those shortcodes are in use". c1131e00b13176947caeb0fbb4286a0605c2c68a commit is fine, but its not been merged into master, or isn't in master any more.

Can you look at this please, I was using the previous version with the modified code above, but updated to 3.3 as It looked like you'd released a fix for this issue however its still broken.

MWDelaney commented 9 years ago

You're absolutely right, somehow that change didn't make it into the release. I've just pushed a release with this fix included.

You may also want to take a look at #77; the error you're getting about undefined functions can be caused if your theme is manually linking the Bootstrap js file(s) rather than enqueuing them with WordPress.

jag1989 commented 9 years ago

No problem, glad to have noticed the issue.