Tag Info

New answers tagged

0

I see that jQuery is loading in the source, but I did not see the bootstrap js file. Here is an example of how you would properly enqueue bootstrap into WordPress and set jQuery as dependency. Github Gist to enqueue Bootstrap


1

Scripts and styles get output with wp_head and wp_footer functions. If you enqueue a style after wp_head, it will be output in wp_footer, which, while in practice will often work, means the theme's html will not validate. It's up to you (or whomever is building a theme/plugin) to enqueue styles early enough to be output in the head. All the data you'd need ...


1

Masonry is already registered by WordPress. From wp-includes/script-loader.php: // Masonry v2 depended on jQuery. v3 does not. The older jquery-masonry handle is a shiv. // It sets jQuery as a dependency, as the theme may have been implicitly loading it this way. $scripts->add( 'masonry', "/wp-includes/js/masonry.min.js", array(), '3.1.2', 1 ); ...


0

Please Provide Proper path to enqueue scripts and styles Example- function theme_name_scripts() { wp_enqueue_style( 'style-name', get_stylesheet_uri() ); wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true ); } add_action( 'wp_enqueue_scripts', 'theme_name_scripts' ); then it will work fine


0

WordPress's wp_register_script has an $in_footer parameter which allows you to state if the script should be written to wp_head or wp_footer. By default the value is false (don't show in footer), but you could try it yourself. Replace your wp_register_script with this: wp_register_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/'. $jquery_ver ...


0

big or small, one or many, enqueuing let people manipulate the order of loading or the source from which a file is loaded. Just because you don't see the value of that right now does not mean there will not be one in the future. Of course you can hand code any change you will need in the future, but part of the advantage of using best practises is that you ...


1

Why are you manually controlling Plugin's javascript files? 1) It's never bad practice to do things like they are supposed to be. That way, when you need to, it's not a mountain to climb. 2) If you're sick and I'm hired to look at your code, I expect javascripts and css to be loaded the proper way. Pasting them in the will only cost me more time and ...


4

Just a few notes on your code You should dequeue and deregister a script to remove it completely from the $wp_scripts global You should not be using wp_print_scripts, this is the wrong hook. You should be using wp_enqueue_scripts Don't wrap your action in a conditional. Your conditional tag might either be set to early or to late and might cause unexpected ...


0

Never mind, I figured it out through another way: add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 ); function my_deregister_javascript() { if ( !is_page('Home') ) { wp_deregister_script( 'jquery-cycle2' ); wp_deregister_script( 'jquery-cycle2-swipe' ); wp_deregister_script( 'cyclone-client' ); } } Still curious why the ...


0

I'm using something like this foreach( $wp_scripts->queue as $handle ) : $obj = $wp_scripts->registered [$handle]; $filename = $obj->src;


-1

put these __initLivescore({"c1":"F0F0F0","c2":"BABCC3","c4":"FFFFFF","c5":"FFFFFF","c6":"C90000","affiliate_id":"0","menu":"1","sportFK":"1","odds":"decimal","lang":"3","timezone":"AUTO","selected_tab":"all"}); code in a js like demo.js file. and then use wp_enqueue_scripts and enqueue this file wp_enqueue_script( 'script-name1', ...



Top 50 recent answers are included