Hotaru Docs


Displaying Widgets

Before you can use widgets, you'll need to install the Widgets plugin.

Widgets are displayed in "widget blocks". By default, there is just one widget block - in the sidebar, so any widgets you add automatically show up in the sidebar when turned on.

You can, however, put widgets anywhere you like on a page by creating additional widget blocks, as described in How to Add Another Sidebar.

Adding a Widget Block

Example: How to display a tag cloud separately from other widgets.

First you'll need to enable the Tag Cloud plugin. Then, wherever you want the tag cloud to show, put this:

<?php $h->pluginHook('widget_block', '', array(2)); ?>

The "2" means second widget block. The first one is already in your sidebar.

Now just go to Admin -> Widgets and move the Tag Cloud widget down to the very bottom and a second widget block will magically appear with the widget in it. Turn it on and you should see the tag cloud on the page, just where you wanted it.

You can add more widgets to that same widget block, or create additional widget blocks for them.

Widgets Without Widget Blocks

An alternative way of displaying widgets was introduced in Hotaru 1.2. Wherever you want the tag cloud to show, put this:

<?php Widgets::singleWidget($h, "tag_cloud"); ?>

You might need to wrap it with a "sidebar" div if it looks a bit strange:

<div id="sidebar">
    <?php Widgets::singleWidget($h, "tag_cloud"); ?>

If you use this method, you'll need to turn off the widget in Admin -> Widgets, otherwise it will show up twice, once in your sidebar and once in the new position.

Note: The first "widget block" method is preferable because the second will throw errors if the Tag Cloud plugin is turned off.

Getting StartedDesign and LayoutPlugin DevelopmentAdvanced TopicsFunction ReferenceTroubleshooting