WP-Syntax Style Sheet Order Fix

I’m using Ryan McGeary‘s excellent WP-Syntax plugin for syntax highlighting of code in WordPress. [It is now maintained by Steve Zahm.]

Update [7 Apr 2014]: I’m, uh, no longer using Ryan’s WP-Syntax plugin… I switched to Crayon Syntax Highlighter so I could have more control over the layout. The examples below are using Crayon now.

Without the plugin, simply using the <code> tag, code looks like this:

/* Hello World program */

#include <stdio.h>

int main( int argc, char *argv[] ) { printf("Hello World");

return 0; }

With the WP-Syntax plugin, it is formatted to make it much more readable:

One problem with the plugin though is that the CSS style sheet for the plugin is being included after some external Javascript in the head element of the HTML document. This prevents some browsers from loading the CSS in parallel which can delay loading of the page. A good way to catch these kinds of things is to use Google’s Page Speed plugin.

Continue reading

Techozoic Fluid Child Theme CSS

So I’m using Jeremy Clark‘s Techozoic Fluid WordPress theme for this site. Kinda cool, eh?

Update [27 Mar 2017]: I’m now using Raam Dev‘s Independent Publisher as my base theme.

I wanted to modify and minify the style.css file and make a couple of other changes. Given these other changes, I decided the best solution was to make a WordPress child theme. So I followed the instructions and expected that the header would reflect my new style.css file.

Alas, taking a look at the page source, it did not:

So I took a look at themes/techozoic-fluid/header.php, and found the problem on line 76:

It looked like get_template_directory_uri() was returning the main theme’s directory, not the child theme. Sure enough, the docs state:

In the event a child theme is being used, the parent theme directory URI will be returned, not the child theme directory URI

The fix was simple. Changing it to the following grabs the css file from the child theme:

Voilà!