Dev:Adding Content to Themes

From Habari Project

Jump to: navigation, search

Since many plugins are being used in the same way, for instance in a sidebar. There should be a standardized output for such plugins.


If your plugin is one that might be placed in a sidebar. Recentcomments, Tagclouds etc is examples of such plugins. The following output in a theme should be working.

<?php $theme->tag_cloud(); ?>

And should, by default, generate the following html output

<h3>Tag cloud</h3>
<ul class="tagcloud">
<li>element 1</li>
<li>element 2</li>

There could also be an option for your plugin that lets the user decide if (s)he wants the header or not.

It's also good to use a template file for your output. This way you allow a theme creator to add themefile for your plugin. When $theme->fetch( 'myplugin' ); is called it will first look for the file myplugin.php in the active themes directory and then in the plugins directory.

function theme_myplugin( $theme )
	$theme->myplugin_var1 = $var1;
	$theme->myplugin_var1 = $var2;
	return $theme->fetch( 'myplugin' );
Other Development Pages · Developer Introduction
Personal tools