Widgets
From b2evolution manual
This manual page is outdated. NEW PAGE: Widgets in b2evolution v5+.
b2evolution skins 2.x now have the ability to handle widgets.
Widgets can be just anything. Think of a widget as a little block of text or HTML that is dynamically generated (or not) and inserted somewhere on your skin (typically the sidebar). Typical examples of a widgets would be the Calendar, the list of categories, etc. But widgets can also be provided by plugins and display weather forecasts for example.
A blog owner can put any widget anywhere he wants it on the skin, provided there is a widget container in that place of the skin. A typical widget container would be the Sidebar. But you will most likely also find a widget container for the Header containing widgets such as the blog title and the blog tagline (you could add a logo widget, etc.).
Skin designers only add widget containers into their skins. The actual widgets are then placed into the containers by each blog owner using that skin. (Note: when creating a new blog, b2evolution populates common containers such as the Header and the Sidebar with some common widgets).
To add a widget container into a skin, a skin designer would use the skin_container() template tag.
To add, remove or reorder widgets in a container, the blog owner would use the admin interface > Blog Settings > Widgets. There is also a shortcut in the evobar under Customize.
Sample Code For Widget for blog title and blog tab
<?php
// ------------------------- "Header" CONTAINER EMBEDDED HERE --------------------------
// Display container and contents:
// ----------------------- Blog Title Widget called here -----------------------
skin_widget( array(
'widget' = > 'coll_title',
'block_start' = > '',
'block_end' = > '',
'block_title_start' = > '<h1>',
'block_title_end' = > '</h1>',
) );
// ------------------------- End of Blog Title Widget --------------------------
// ---------------------- Blog Tagline Widget called here ----------------------
skin_widget( array(
'widget' = > 'coll_tagline',
'block_start' = > '<h2>',
'block_end' = > '</h2>',
'block_title_start' = > '',
'block_title_end' = > '',
) );
// ------------------------ End of Blog Tagline Widget -------------------------
// ----------------------------- END OF "Header" CONTAINER -----------------------------
?>
