WP-Syntax Colorizer

WP-Syntax is a fantastic WordPress plugin which automatically syntax-highlights source code in <pre> blocks for a large number of languages, using GeSHi. Unfortunately, styling WP-Syntax’s output can be a bit of a headache, particularly with regard to some undocumented functions.

I have put together WP-Syntax Colorizer, a WordPress plugin that gathers all of the work required to set custom colors for your code snippets, and you can simply run it alongside WP-Syntax. Customizing couldn’t be easier.

Example

The following code snippet has been styled with WP-Syntax Colorizer:

$query = "SELECT u_username, u_firstName, u_lastName FROM userTable";
$users = mysql_query($query);
while($row = mysql_fetch_assoc($users))
{
	echo "<div class="user">";
	echo "<strong>".$row['u_username']."</strong> <em>".
	$row['u_username']." "."</em>";
	echo "</div>";
}

Installation

  1. Upload wp-syntax_colorizer.php to the /wp-content/plugins/ directory.
  2. Edit the colors in wp-syntax_colorizer.php to fit your needs.
  3. Upload the modified wp-syntax.css into the root directory of your theme, if you want to match a dark-colored theme.
  4. Activate the plugin through the ‘Plugins’ menu in WordPress.

Where to get it

You can find a download link for the plugin here at WordPress.


About this entry