Lazy loading images for flexslider

Flexslider is one of the most used sliders, for good reason. This snippet helps lazy load your images.

In order to create a perceived performance for users, we as authors shouldn’t allow the loading of every single image at once for sliders or carousels. In this snippet we only load the first and second image on init window load.

Adding Class to WordPress Post Thumbnail

If the desired output of the default WordPress post thumbnail is not enough you can easily adjust the PHP to output your appropriate class. <?php the_post_thumbnail(‘post-thumbnail’, array( ‘class’ => “YOUR CLASS”)); ?> More information can be found on the codex.

Change Font-Size within Input Field Based on Length

Recently I had a great conversation with an outstanding User Experience designer about a few interactions on a project we were working on. One of the points we talked about was, what should happen when text within input fields are excessively long.

The desired result we both agreed on was to change the font size on the fly. Thankfully this is extremely easy with a little bit of jQuery that listens to events on the input field.

So if you happen to be in the same situation hopefully these snippets should get you heading down the right track.

Add Shortcodes in Widgets

If you use shortcodes within your WordPress theme you might need to also add them within your widgets. This little snippet does the trick.

Remove Telephone Styling in iOS

Viewing telephone numbers on iOS device can provide an unpleasant shock. They tend to render in a default blue colour making your designs look broken.

Adding Toolbar Menus in WordPress

If developing themes or plugins for WordPress sometimes it is handy to add a menu item to the WordPress admin bar to help quickly reference the desired action.

You can do various things with the admin bar but this snippet should help you get started.

Exclude IP Address From Google Analytics

If you have installed Google Analytics on your site, or for a client it is always helpful to exclude IP addresses so the sites stats give an accurate representation of the real traffic.