Jake Bresnehan

Add Class To Body If JavaScript Is Enabled

This snippet is super small but is super handy. It detects to see if JavaScript is enabled on the users browser. If yes, a class will be added to the <body> tag Adds the class yourClassName to <body> tag if Javascript is enabled.

Recent Post Shortcode

WordPress shortcodes are a simple way to set up functions to create macro codes for use in post content. For instance, the following shortcode (in the post/page content) would add your recent posts into the page: It’s pretty simple and brings your WordPress blog alive with ease. Recent Post Short Code In WordPress 1 Add this code to your functions.php file. 2 … Read more

Force Up and Down Arrow for Number Input

Those with a keen eye will notice that the up and down arrows for the number input doesn’t show up in Chrome (and some other WebKit based browsers) until you hover or are focused on the input. To force the arrows to be visible we just need to change the opacity of the inner and outer spin button.

How to change the Input Font Size based on Text 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 of the html input field … Read more

Sass Clearfix Mixin

There are a few ways to implement the clearfix hack but the following Sass Mixin has been in my toolbox for the last year thanks to this article on Nicolas Gallaghers blog. Usage:

Linking to an Image Folder Within a WordPress Theme

During WordPress theme development you will more then likely need to display some images that are located within your theme directory. The location of the images folder can vary greatly. It really comes down to how you like to set things up. Generally speaking if you were to have an images folder in the root of your theme you can … Read more

URL as a Sass Variable

Do you ever find yourself trying to remember the URL path of you images directory? Well with Sass you can quickly add the path to the desired location and just use the variable throughout your code. Sass to the rescue. All you need to do is declare the variable and then use the interpolation syntax when you reference it. More … Read more

Load a Different Header in WordPress

This little snippet can come in handy when you need to serve a different header on a per page basis. All you need to do is create a new header file – header-yourfilename.php and then put in some logic in your desired template file. In my case I have a header file called header-home.php and in my homepage template I … Read more

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. This … Read more

Text Input Non-Editable

If you ever need to make an input field or text area non-editable the readonly attribute comes in very handy. When the readonly attribute is present in the markup, it specifies that the user will not be able to modify the value. However the user will still be able to tab to it and copy the text. Note: The readonly … Read more