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:
Open a text editor of your choice, then browse to the
twentyfourteen
theme folder, and look forfunctions.php
. Add the following code at the bottom of the file:/* * Adds support for the Less preprocessor to your theme. * * @since Twenty Fourteen 1.0 * @param string $current_user Determines the currently logged in user */ if ( ! function_exists( 'less_enqueue_scripts' ) ) { function less_enqueue_scripts() { $current_user = wp_get_current_user...