Apr 16, 2008
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 "
";
echo "".$row['u_username']." ".
$row['u_username']." "."";
echo "
";
}
Installation
- Upload
wp-syntax_colorizer.phpto the/wp-content/plugins/directory. - Edit the colors in
wp-syntax_colorizer.phpto fit your needs. - Upload the modified
wp-syntax.cssinto the root directory of your theme, if you want to match a dark-colored theme. - 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.



At the end of wp-syntax_colorizer.php, I added:
$geshi->set_methods_style(1, 'color: #19ccff', true);
Which makes it so you can color the methods also.
Thanks sharms! I’ll add this in the next release.
nice feature. It would be nice if there were some default colors for html and php for the truely lazy among us.
Thanks sharms, Very Great Tips…
currently im using wordpress 3.0.1 and dont know why i cant call this plugin into post. can you help me in this? its quite frustating since the instalation works fine