I’m a heavy user of LESS and I rejoiced when I learned that some geeks plugged in the LESS PHP-compiler into WordPress – and it works out of the box! I didn’t experience any issues with syntax (although you sound be careful as there are little difference between the LESS compilers) and the LESS files in my child theme were automatically compiled.

Just go to https://wordpress.org/plugins/wp-less/ and get the integrated LESS compiler.

Enqueue your LESS stylesheet like you would normally enqueue your .CSS. (you can change back to minified .CSS on a production environment, but with fast cashing, there’s not even a need for that. Here’s how I enqueue mine:

if (class_exists('WPLessPlugin'))
wp_register_style( 'custom', get_stylesheet_directory_uri()."/css/custom.less" );
else {
wp_register_style( 'custom', get_stylesheet_directory_uri()."/css/custom{$min}.css" );

Note that I check if the plugin exists, and if it doesn’t I just include my precompiled css. Then I list it with the recommended plugins. This is best practice.


LESS is a breeze. It allows me to write such clean, reusable and responsive CSS that it is the nr. 1 tool hands down that speeds up my (child) theme development. Actually, when you look at all the commercial themes offering “super sliders, portfolio pages, full responsive blahblah” the only thing that really distinguishes them is their styling – and that is something we can do very, very efficiently.

I borrow mixins from all over the web and will share my (aptly?) named file <pre>more.less</pre> here soon, so check back in a few days!.

One thought on “WP_less

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.