libreform / wp-libre-form

Easy native HTML5 forms for WordPress. Version 1.5 is unmaintained, but works without issue. 2.0 has been rewritten from the ground, and can be found at https://github.com/libreform/libreform
https://wordpress.org/plugins/wp-libre-form
GNU General Public License v3.0
67 stars 27 forks source link

Enqueue JS within shortcode #60

Closed ideag closed 7 years ago

ideag commented 7 years ago

I can see that you are currently conditionally loading JS when the shortcode is present within post content. That means developers have to manually enqueue scripts if they use the form anywhere else in the site - widgets, templates, etc.

But since the JS is footer-based, why not just enqueue it within shortcode method, so it gets loaded anytime someone uses the shortcode, no matter where?

anttiviljami commented 7 years ago

Sounds logical! I don't see any reason why this would cause issues, but will gather some feedback first...

Thanks for the PR!

ideag commented 7 years ago

My pleasure. I love the premise for this plugin and I hope it will gain traction with developers in time.

ideag commented 7 years ago

This makes the readme section Using the shortcode outside post content obsolete, so that should probably be removed.

anttiviljami commented 7 years ago

:+1: a0bc975