• CDN jQuery in WordPress – the right way

    Something i’ve struggled with in the past is how to load a CDN version of jQuery into WordPress, but ensure that it’s the same version that comes loaded with the WordPress core. That way when you update WP or plugins, things won’t break because you’re loading an older version on jQuery. So this is what I came up with, it includes a fallback that calls the bundled WP jQuery if the CDN isn’t available: function jquery_cdn(){ if( !is_admin() ) { // Get the WP built-in… more

  • HTML5 Input Placeholder Fallback

    If you’re wondering how to support the HTML5 placeholder attribute for inputs and textareas, here’s a simple solution using Modernizr and a jQuery Placeholder plugin by Mathias Bynens (also used in Zurb’s Foundation). First we detect browser support and apply the placeholder plugin if it’s available, with an ‘ol fashion HTML label as fallback. if( !Modernizr.input.placeholder ) { // Browser does not support input placeholder attribute if( $.fn.placeholder ) { // The plugin exists, use it! $(‘input, textarea’).placeholder(); } else { // Browser doesn’t support… more