Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to load CF7 JS only on pages that contain CF7 contact form #28

Open
buzztone opened this issue Dec 23, 2018 · 8 comments
Open

Comments

@buzztone
Copy link

This scripts.js optimization question in the CF7 Forum raises an interesting idea.

Can you please add option to load it ONLY on pages that ACTUALLY contain CF7 contact form(s)? Even if we manually have to enter/define pages by names/slugs, it will be fine with me.

It may not be technically feasible, but adding manually a list of pages with CF7 forms would probably not be burdensome for most CF7 users.

@geminorum
Copy link

Theoretically, It can be done simply by calling the scripts on short-code rendering (#9346), but the cf7 authors are actually, very hard to reach!

@buzztone
Copy link
Author

buzztone commented Dec 24, 2018

I have regular contact with the CF7 plugin author, Takayuki Miyoshi. I've found him very approachable.

I’ve found Takayuki is open to detailed, well researched & tested code submissions, that meet what he sees as the needs of the majority of CF7 users.

@geminorum
Copy link

geminorum commented Dec 24, 2018

Where can I report bugs?

@kasparsd
Copy link
Owner

In cases when all scripts are being concatenated it is better to have all required scripts to be enqueued on all pages since then only one "bundle" script is generated and retrieved from cached on all subsequent requests.

It would be useful to have a toggle for this in the Controls plugin, though!

@geminorum
Copy link

On the new update of cf7, using reCAPTCHA v3, the badge will show on every single page of the site. Concatenated scripts is not optimal for specific functionality of a single form.

@buzztone
Copy link
Author

Where can I report bugs?

Use form at https://contactform7.com/contact/. Be nice & you'll usually get a nice response.

@buzztone
Copy link
Author

It would be useful to have a toggle for this in the Controls plugin, though!

Definitely sounds like there should be an option. There are clearly cases where either option will be a better choice.

@buzztone
Copy link
Author

@kasparsd see rocklobster-in/contact-form-7#1278 (comment). Takayuki is planning to add an action hook in the shortcode callback function or somewhere else to make it easy for add-on plugins to implement the same script loading control. Takayuki is doing this to allow other plugins to add this option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants