b2 plugin support

On the b2 forums there are plenty of hacks and enhancements to b2. While there are guidelines to writing hacks they’re informal, and many hacks rely on changing existing code.
I’m using the Smarty plugins support to provide a consistent and documented way of writing plugins.
I created a simple “googleit” function already. It’s integrated into the post.tpl template of this blog and provides the “Search” link you see below.
Using Smarty plugins is easy. You create your function, call it a predictable name (smarty_function_name() where name is “googleit” for example), put it into a file and drop that file into the plugins directory.

The usual advantage of using Smarty caching applies here too. Once it’s cached the plugin isn’t loaded again until it’s called so you can drop as many plugins as you like into the plugin directory without suffering any speed loss!

By Donncha

Donncha Ó Caoimh is a software developer at Automattic and WordPress plugin developer. He posts photos at In Photos and can also be found on Twitter.

1 reply on “b2 plugin support”

Leave a Reply