162

Reading time ~1 minute

This is pretty intermediate in skill level for creating templates. This is to say, in order to be able to create WordPress themes, you need to have a certain familiarity with PHP code. This is one of the many setbacks of WordPress. Never-the-less. They are the most popular CMS engine out there, so if you wish to make it out there creating templates, you better strap in for the learning curve that is coming to you.

Anyways, with WordPress, you can hardcode this right into the head, but it is recommended that dependencies are enqueued into the wp_head() portion of the template. If you do not use wp_head(), then your template will not be able to take advantage of all the features available as a WordPress theme.

Here is a sample of what the enqueuing looks like for LESS.js (Credit to: carlorizzante.com)

<?php
// Setting paths to the resources we will need later, js and styles
$path_to_js 	= get_stylesheet_directory_uri() . '/library/js/';
$path_to_styles = get_stylesheet_directory_uri() . '/library/styles/';
// We don't want to load unnecessary things when browsing the Dashboard, right?
if ( ! is_admin() ) {
	function load_LESS() {
		// Retrieving the paths we set above
		global $path_to_js, $path_to_styles;
		// Actually printing the lines we need to load LESS in the HEAD
		print "\n<!-- Loading LESS styles and js -->\n";
		print "
<link rel='stylesheet/less' id='style-less-css'  href='" . $path_to_styles . "style.less' type='text/css' media='screen, projection' />\n";
		print "<script type='text/javascript' src='" . $path_to_js . "less-1.1.3.min.js'></script>\n\n";
	}
	// Adding the action to the HEAD
	add_action( 'wp_head', 'load_LESS' );
}
Cool eh?

Quick Laravel/Lumen install with Docker!

The default installer that comes with Laravel is great, but unfortunately that means you have to install dependencies of PHP and Laravel/...… Continue reading

PHP To Python

Published on February 24, 2016

Aftertouch in Logic Pro X and 2015 Macbook Pro

Published on February 24, 2016