Register & enqueue your WordPress theme’s scripts and styles The Right Way™

Posted on Leave a comment

If you’ve been building themes for a while, and happen to have come from a HTML/CSS background, you’ll remember the days when you hardcoded calls to your theme’s linked stylesheets and JavaScripts directly in the <head>. While this still works just fine, there’s a WordPress way of doing this: by enqueuing the scripts and styles from functions.php.Enqueueing […]

Add ‘even’ and ‘odd’ class to the WordPress post_class()

Posted on Leave a comment

You might find the need to have alternate ‘odd’ and ‘even’ styles for your posts. While you can define these as needed on the front end, I find it a whole lot more useful to define a function that adds these alternating classes to the post_class() function. Its quick, easy and painless. To make sure that when […]

Limit backward compatibility of your WordPress theme

Posted on Leave a comment

Approach any WordPress solution with the same ferocity designers approach the browser wars: be reasonable but also unmistakably ruthless! WordPress development seems to happen briskly and is applaudably fast. If, lets say, you’re a freelance front-end developer working in different languages and building across different platforms for your various clients and projects, by the time […]

Make that $#!% pluggable

Posted on Leave a comment

Be nice to the children When a new function arrives in WordPress and you want to make sure your theme still functions ok in older version of WP, you check to see if the function is supported first before defining it. If for some unforeseen reason you needed to build and support a theme running […]