Category Archives: WordPress

WordPress Plugin: Nivo Slider Loading Slow

Nivo Slider is one of the best slider tools available for WordPress … until you’ve had too much fun and suddenly have too many images in it. So what do you do when Nivo Slider takes too long to load? Add a single line of CSS, hide any image that doesn’t need to be displayed initially.


.nivoSlider img:not(:first-child) {display:none;}

Now, as you may know the :not and :first-child selectors are CSS3 so anything before IE8 will still see long loading times.

Nginx 504 Gateway Time-out in WordPress

I got this error after changing a template on one of the pages on my local machine, but as it turns out, the template had nothing to do with the time-out. It was just a delayed reaction. Some things I immediately tried was restarting nginx and also increasing the PHP memory cache to 64MB but neither thing worked.

The reason I received the error was because I duplicated the theme folder to have a backup and it was clogging up my WordPress setup. After I removed the duplicate theme, everything went back to normal. I’m glad that turned out to be an easy fix.

Why am I getting “jQuery is not defined” Error in WordPress?

It sounds like your script is being loaded before jQuery, a couple of things will help you fix this:

First, you’ll want jQuery to recognize the $ shortcut so open up your .js file. I’m naming mine main.js and this bit of code:


jQuery(document).ready(function($){
   $('#hover-bullet1').mouseover(function() {
     $('#bullet-details1').removeClass('pretty-hide');
     $('#bullet-details1').addClass('pretty-hover');
   });
});

Note: Look at the first line closely, you want the to include the $ in the function.


Next, load in your file AFTER jQuery has finished loading, here’s how:
Open header.php from your theme folder.
Search for wp_head();
Add your script tag AFTER the php close tag that looks like this: ?>


...
   wp_head();
?>
<script type="text/javascript" src="<?php bloginfo("template_url"); ?>/js/main.js"></script>

Hope that helps!