2009
Jul
Sat
18

Code Snippets Plugins

Filed under: Web Technology, Wordpress

I’ve been trying to find a really nice code snippet plugin. Well I finally found some.

Snippet Hightlight by DesignPraxis

$x = 1;
$y = 2;

// 1 + 2 = 3
echo $x + $y;

Snippet Highlight allows me to place my code anywhere on the page by the use of <pre></pre>. However it isn’t language specific and I think it only works for a few languages. It’s a simple highlighter without any fancy stuff the others may have.

FV Code Highligher by Frank Verhoeven. You can view samples on the website. It works for CSS and HTML only at the moment. The design of the code box is pretty.

SyntaxHighligter is an amazing code snippet highlighter and supports many languages, you can find the list of supported languages here. It also has a little toolbox in the corner when you mouse over the code. You simply need to wrap your code in [language]. It comes with a page for settings too.

$x = 1;
$y = 2;

// 1 + 2 = 3
echo $x + $y;

The last one is Wordpress Code Snippets by Allan Collins which is also a good highlighter. It supports many languages and has some neat functions (plain view, copy and print). The only problem is that the code appears at the end of a post/page and I can’t choose to have it in the middle. The plugin inserts a textarea underneath the WP post/page textarea where I would choose the language and insert my code. I won’t be able to display more than one piece of code per page. This is the reason I’m talking about this plugin last although it’s the first I found.

I read here that Allan is working on the issues I just mentioned. I looking forward to seeing the next release to this plugin.

2009
Jun
Sat
6

Wordpress: showing top 5 catagories

Filed under: Web Technology, Wordpress

I was working on a catagory problem for a client today. I had to place the catagories in the top header, like how the pages appear on this site. It took me some time because the client wanted catagories in the top navigation and in the sidebar so required me to alter their CSS a little as the styling was different.

They also wanted it to only show the top 5 catagories.  I read the WP documentation and couldn’t find anything. A simple Google search solved my problem, and I found this article: How to show 5 top categories in Wordpress. It was such a simple solution, I was so silly not to think of it.