Tag Info

Hot answers tagged


You're mixing up the singular wp_enqueue_script, which adds a script, with the plural wp_enqueue_scripts which is an action and a function that triggers that action. I think you want function theme_scripts() { wp_enqueue_script( 'custom-script', get_template_directory_uri() . '/js/menu-fix.js', array('jquery'), '1.0', true); } ...


Note that if any script in the header at all needs jQuery then it will bump it to header, regardless if it's changed to be enqueued for footer. So while changing it to be queued for footer makes sense it rarely works out when a lot of script stuff is going on.


the console is firing this error: TypeError: $ is not a function Could be a few things: WordPress loads jQuery in no-conflict mode so you may need to use jQuery instead of $ when making your selections jQuery('your-selector) Be sure that jQuery has loaded before you set your interval. Based on what I can see you may be trying to access if before ...


Try to remove this from footer.php <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> And One tip: Use wp_enqueue_script to load all JS on your web page.


Here is the problem If you try to register or enqueue an already registered handle with different parameters, the new parameters will be ignored. Instead, use wp_deregister_script() and register the script again with the new parameters. You will have to deregister jquery first, the register it again, but becareful because the empty string isn't ...


Here is what I ended up doing based on @gdaniel's suggestion: AJAX call: $('.btn').click(function() { $.ajax({ url:"<?php bloginfo('template_directory'); ?>/inc/galleries.php", type: 'POST', data: {postID: '<?=$post->ID;?>', galleryCategory: $(this).attr("data-content")}, success: function(resp) { ...


id="mySlide"is used twice in your markup. Just try removing slideExpr: '#mySlide' from your plugin options. Try using bloginfo('stylesheet_directory').


Do not use an external jQuery library, use the one that comes with WordPress. Use wp_enqueue_script to enqueue your scripts, like: wp_enqueue_script( 'jquery' ); Additionally be aware that WordPress sets the internal jQuery to noConflict() mode, more information about that here.


How to get a notification via Javascript when the left menu bar has been collapsed ? If you are taking about the admin menu bar and you want to get a notification when the that is closed and expanded, then watch thoroughly that, when admin menu bar is collapsed, a folded class is added to the body. You can get any notification according to that.


The dependencies are case-sensitive - you need array( 'jquery' ) (no uppercase Q).

Only top voted, non community-wiki answers of a minimum length are eligible