Adding Easy Digital Download Cart Quantity to Menu

When using the popular e-commerce plugin Easy Digital Downloads it is very common you will want to add the cart quantity to the menu. There are a few ways to do this but I have found adding it to the wp_nav_menu is great for styling consistency and maintainability.

Get URL with JavaScript

At some point in time you need to get the current URL and do some logic based on it. JavaScript has handy API called `window.location` which has all the information related to the windows current location.

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.