Category: Code

Selectivizr with CSS on a sub-domain

Updating the Soupgiant base WordPress theme recently (among other things we were porting it to HTML5), we needed to decide which shims and/or polyfills to use. We starterd with Remy Sharp’s HTML5 enabling script but another to consider was Selectivizr to improve IE‘s support of CSS3 selectors.

Code

A half-baked (CSS) idea

Spritebaker has done the rounds a fair bit in web development circles over the past few weeks. It’s a great idea, done well. The only problem is it has the strange effect of making it seem like the page is actually taking longer to load. I take a look at a possible solution.

Code

JavaScript Localisation in WordPress

I was asked on Twitter recently if it’s possible to pass WordPress data to JavaScript, wp_localize_script() is the tool to do it with.

Code

Delay Print Stylesheets Plugin

A few weeks ago I wrote a post in which I adapted an idea from a zOompf article to delay the loading of print stylesheets until after a web page has fully rendered. I’ve decided to convert the code from the original post into a plugin and add it to the WordPress plugin directory.

Code

Delay loading of print CSS

Recently I stumbled across an article detailing browser performance with the CSS print media type. In most recent browsers the print stylesheet held up rendering.

The article suggested a solution, which I decided to automate for WordPress.

Code

Getting the bloginfo correctly

One of the standout problems when using plugins with WordPress MS is when they define a constant for the plugin’s url as the script starts executing.

Code

‘Skip to Content’ Links

Josh and I were discussing the positioning of Skip to Content links on a website. In the past I’ve placed these in the first menu on the page, usually positioned under the header.

Code

Valid Isn’t Best Practice

Not long ago, on the @soupgiant account, I tweeted “Vaild html / css doesn’t indicate your code is best practice; it may even indicate the opposite. #css3”. Neither the xHTML nor the CSS on this site validates, we consider it to observe best practices.

Code

JavaScript the WordPress Way / Part 2

In Part 1 we introduced the wp_register_script and wp_enqueue_script functions developed to avoid JavaScript conflicts.

In this section we’ll deal with a more complicated example. We’ll also take what we’ve learnt about including JavaScript and apply it to our CSS.

Code

JavaScript the WordPress Way / Part 1

Problems arise when your theme or plugin both use the same JavaScript library or if Prototype and jQuery are both used on the same site.

Two of the most important WordPress functions are often ignored by WordPress theme and plugin developers. Introducing: wp_register_script and wp_enqueue_script.

Code