Adding support for Less in WordPress

With WordPress installed and working, it's time to turn our attention to adding support for Less.

In older versions of WordPress, it was customary to add this directly to the header.php file. While it worked fine, it meant we couldn't maintain a clear separation between HTML content and presentational markup. Thankfully, in more recent versions, the WordPress team moved to adding the style sheet by using a function stored in the functions.php file. Let's take a look at how to achieve this now:

  1. Open a text editor of your choice, then browse to the twentyfourteen theme folder, and look for functions.php. Add the following code at the bottom of the file:
    /* * Adds support for the Less preprocessor to your theme. ...

Get Learning Less.js now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.