As I use Habari more and more and continue to fill in the cracks in this theme, I am finding more ways to use the functionality it has. The newest thing I have been playing with is the tags, or more specifically how to use tags to control options in the theme.
Tags are usefuly for organising content but, similar to the class attribute in HTML, there is no need for them to be constrained to human use only. Think microformats for one example.
In this theme the top menu displays the pages, but I wanted to exclude one. Now I could easily add a new checkbox to the page form to exclude items from the menu, and I may yet do that, but for the moment I decided to use tags to control things.
Pages that I have tagged 'menu:exclude' will not be included within the menu.
This approach, a tag of object:action, could be used in any number of places across the theme so it is very flexible. I could, for example, use it to change the colour of the menu for certain pages, the sidebar that gets loaded, or anything else.
Of course, I wouldn't want these tags to be visible to visitors of the site so a very quick function in themes.php will filter out any tags with a colon in them when the list of tags is output.
function filter_post_tags_out( $tags ){ foreach ($tags as $tag){ } return $newtags; }
The simplicity of adding form fields using plugins means that it is probably preferable to do that, but using similar techniques tags can be extended to all kinds of organisational uses, so the method is interesting nonetheless.
This blog is my stage for investigating and using Habari. This is my place to try new themes and plugins in the real world and live with it on a day to day basis.
Leave a reply