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

Schemaorg Rich Snippets 'Rating' Button not working when Autoptimize optimize javascript is enabled #43

Open
yelnyafacee opened this issue May 19, 2017 · 1 comment

Comments

@yelnyafacee
Copy link

hi, I am using both Wordpress Autoptimize and Schemaorg Rich Snippets, but when Autoptimize 'optimize javascript' option is checked, the schemaorg Rich Snippets Rating button no longer works. Is there a way to convert the jquery code to plain javascript? or include the option to use non-js rating buttons or jquery rating buttons? thanks

@graylaurenm
Copy link
Contributor

I can add more information to this.

Site: RasaMalaysia.com
Problem: When jQuery is deferred, inline scripts don't work.
Evidence: Console error pointing to inline click function. Ratings in the recipe snippet don't save (no alert pops up). Note: ratings in comments continue to work.

I can create a fairly messy solution for this by removing and then enqueuing the (relevant) inline JS. Is it possible to implement a similar solution into your code? I can create a pull request with these particular updates, but I notice other inline JS exists.

Attached: my altered functions.php file and new js file, which are currently working on our site.
inline-js-fix.zip

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

No branches or pull requests

3 participants