Masonry – Can’t Find Variable imagesLoaded

I discovered that by removing the footer.php file, I was removing a link to the function wp_footer(); which essentially does this: function wp_footer() { /** * Print scripts or data before the closing body tag on the front end. * * @since 1.5.1 */ do_action( ‘wp_footer’ ); }

Enqueue script, taking no effect [closed]

Try this to set the alert if you’ve scrolled 100px from the top of the page. jQuery(document).ready(function ($) { $(window).scroll(function(){ var ScrollTop = parseInt($(window).scrollTop()); if (ScrollTop > 100) { alert(“You’ve scrolled 100 pixels.”); } }); }); Here is a JSFiddle showing it in action. Assuming you want to do more than just show an alert, … Read more

File not enqueueing

I found the problem with my enqueue statements. There was a space ahead of the handle name of the wp_enqueue_scripts statements for both “tablesorterjs” and “tablesorterfunctions”. Once I removed the space in front of the handle name, the scripts enqueued. wp_register_script( ‘tablesorterjs’, plugins_url( ‘/js/jquery.tablesorter.js’, __FILE__ ), array(‘jquery’) ); wp_enqueue_script( ‘tablesorterjs’ ); wp_register_script( ‘tablesorterfunctions’, plugins_url( ‘/js/tablesorter.js’, … Read more

JQuery and Javascript to pan image

I had to overcome two issues to resolve this. The 404 error was due to the way I registered the script. It pointed to the parent theme folder, while I had saved the .js file to the child theme folder. For the moment, I’ve put a copy in the parent theme folder, and am looking … Read more

WP Media Uploader modal conflicts with Bootstrap modal

Just proxy the modal-open class for Bootstrap like this: .bs-modal-open { overflow: hidden; } .bs-modal-open .modal { overflow-x: hidden; overflow-y: auto; } // or using sass … .bs-modal-open { @extend .modal-open; } Add/remove the bs-modal-open class to the body when opening/closing a BS modal: $(‘.bs-modal’) .on(‘show.bs.modal’, function (e) { $(‘body’).addClass(‘bs-modal-open’); }) .on(‘hidden.bs.modal’, function (e) { … Read more

comment-reply.js disables any other form javascript

I found the cuplrit and has nothing to do with comment-reply.js. I was targeting my javascript based on which template and of course the javascript wasn’t loading. if( $(“body”).hasClass(“page”) ){ … Needed to add this: if( $(“body”).hasClass(“page”) || $(“body”).hasClass(“single”) ){ …

Jquery not loading / running on WordPress home page

You have initialized the script twice. Here is the updated script: jQuery(document).ready(function($) { var $window = $(window), win_height_padded = $window.height() * 1.1, isTouch = Modernizr.touch; if (isTouch) { $(‘.revealOnScroll’).addClass(‘.animated’); } $window.on(‘scroll’, revealOnScroll); function revealOnScroll() { var scrolled = $window.scrollTop(), win_height_padded = $window.height() * 1.1; // Showed… $(“.revealOnScroll:not(.animated)”).each(function () { var $this = $(this), offsetTop = … Read more

Jquery code won’t run loaded from WP, but run from console

Ok, the code is fine, the problem is that the target button[data-id=”select-especialidad”] is being used by bootstrap-select and even if the script load before my code, it takes a few seconds or less to process the information. So the code should be wrapped after a function that checks that the event has been loaded. This … Read more

I can’t enqueue Suggest.js in frontend – not added

Provided you’ve confirmed that WP’s native ‘suggest’ script is actually being rendered on the page properly (ie. you’re using the correct template for home vs front-page), sometimes to avoid script conflicts on the page, you need to wrap your script in an anonymous function. So something like: <script> (function($) { $(“#my_input”).suggest(“<?php echo get_bloginfo(‘wpurl’); ?>/wp-admin/admin-ajax.php?action=ajax-tag-search&tax=my_taxonomy”, { … Read more