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

javascript cookie notice #36

Closed
andreapaiola opened this issue Sep 25, 2018 · 7 comments
Closed

javascript cookie notice #36

andreapaiola opened this issue Sep 25, 2018 · 7 comments

Comments

@andreapaiola
Copy link
Contributor

andreapaiola commented Sep 25, 2018

how can I load css and javascript of this plugin?

https://wordpress.org/plugins/cookie-notice/

https://github.com/dfactoryplugins/cookie-notice/blob/master/cookie-notice.php#L825

@bartoszarendt @lucspe @cristianp6 @chesio

I see the css, but not the js...

@bartoszarendt
Copy link

most probably your site is missing the wp_footer() function and you don't have js included

@andreapaiola
Copy link
Contributor Author

most probably your site is missing the wp_footer() function and you don't have js included

thank you, but nope

schermata 2018-09-25 alle 11 44 02

schermata 2018-09-25 alle 11 45 09

@bartoszarendt
Copy link

please share a link to your site first

@andreapaiola
Copy link
Contributor Author

please share a link to your site first

sorry, I can't because it's not public

@andreapaiola
Copy link
Contributor Author

andreapaiola commented Sep 25, 2018

ok, it loads if I comment

wp_deregister_script( 'jquery' );

in the theme

https://github.com/Alecaddd/awps/blob/master/inc/Setup/Enqueue.php

jQuery is a dependency, of course

@chesio
Copy link

chesio commented Sep 25, 2018

jQuery is a dependency, of course

WordPress does not output a script, if any of its dependencies is unknown (= not registered), as you just have learned. So why do you deregister jQuery at all? A lot of plugins has scripts that depend on jQuery.

@Alecaddd
Copy link
Owner

Alecaddd commented Sep 25, 2018

I use wp_deregister_script( 'jquery' ); because WordPress comes with an outdated version and it's always enqueued in the Header and not in the Footer.

I bundle jQuery inside the webpack.mix.js file on line 29.

Some plugins have the enqueue option with a dependency listed as the third parameter.
Usually is something like this array('jquery'), to let WordPress know that script requires jQuery in order to work.
More info here: https://developer.wordpress.org/reference/functions/wp_enqueue_script/

If you remove the wp_deregister_script( 'jquery' ); from the Enqueue.php file, be sure to comment out the mix autoload to avoid bundling jquery in the compiled assets.

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

4 participants