blogging

Wordpress Toolbar Plugin and Wordpress Prefixes: A Fix

BandaidFirst of all, that’s an awesome plugin that will allow your visitors to have a look at external links while retaining the ability to comment locally on your blog. Get it!

Unfortunately, if you have modified your Wordpress database prefix, for instance because you are using Wordpress MU or the Virtual Module, the toolbar will fail to display.

Here is my very modest fix that will make it work.

1. Open wordpress-toolbar/toolbar.php

2. Find, near the top of the file:

$resultset = $wpdb->get_results("SELECT * FROM wp_options where option_name in ('wordpress_toolbar_social','wordpress_toolbar_excludedomains','wordpress_toolbar_skin','wordpress_toolbar_custom')");

Replace with:

$resultset = $wpdb->get_results("SELECT * FROM {$wpdb->options} where option_name in ('wordpress_toolbar_social','wordpress_toolbar_excludedomains','wordpress_toolbar_skin','wordpress_toolbar_custom')");

3. That’s it!

If you enjoyed this post, make sure you subscribe to my RSS feed!


A very geeky Holidays break

Kill BillWas your break as geeky as mine? Come on, admit it: you’ve done at least one incredibly unsexy thing in the last couple weeks. I know I have. Well, in fact, I had to take a four weeks-long break and it shows in the number of silly things I’ve played with.

In no particular order:

If you enjoyed this post, make sure you subscribe to my RSS feed!


Four Top Wordpress Code Highlighters Reviewed

I recently ran a whole lot of Wordpress code highlighting plug-ins through the grinder and ended up selecting four that, in my opinion, are the worthiest of the lot.

Writing a code highlighter plug-in proves to be a fairly difficult exercise. Your plug-in needs to be smart about its content, or the result will invariably be a disappointment. For instance, if the plug-in is activated using the <pre> tag, then it needs to maintain a stack/counter of <pre> and </pre> tags so that finding a <pre> tag in the code being highlighted doesn’t abruptly terminate the code parsing, disfiguring your blog in the process. I noticed the issue with SyntaxHighlighter, but the other plug-ins may also suffer from it.

SyntaxHighlighter

Tag: [sourcecode language='css']code here[/sourcecode]

My main issue with this plug-in is that it works in visual mode; hence, your source code formatting (tabs etc.) is lost. Other than that, it works well and support a wide range of languages and it offers several very nice features such as ‘copy to clipboard’ or ‘print’. My hope, right now, is that I did not use it correctly.

syntaxhighlighter sample

Rating: ★★★☆☆

Highlight source Pro

Tag: <pre lang="enc__php" class="17">code here</pre>

I do not like the use of the class arguments, as it means “start numbering with line 17″ which totally breaks XHTML compliance.

Note the smart use of the enc__ prefix, which, when presents, means that the code being highlighted is encoded using HTML Entities. Add the prefix, you can use the higlighter in visual mode; omit it and work in HTML mode.

highlight source pro sample

Rating: ★★★½☆

FV Code Highlighter

Tag: {code type=php}code here{/code}

Cute display, which will feel immediately familiar to Dreamweaver aficionados. Support PHP, HTML, CSS and XML.

fv code highlighter sample

fv code highlighter admin

Rating: ★★★★☆

WP_CODEBOX

Tag: <pre lang="php" line="1" file="example.php" colla="-">code here</pre>

In my opinion, this is the winner. It works well, looks good and support more languages than any of the others — I counted about 70 different formats!

You can display the code box collapsed or expanded, offer a link to download the code, etc.

wp codebox sample 1

wp codebox sample 2

wp codebox admin

Rating: ★★★★½

If you enjoyed this post, make sure you subscribe to my RSS feed!