The widget areas

Posted on January 11, 2020

Updates

Widget areas are the blocks where our widgets or other pieces of code will be placed. The list of widget areas are declared in the theme.php file of the theme folder like this;

Config::$widget_area = ['head','body','foot','column','post.after'];

This list is used from the widget editor so we can choose where to place the widgets. In order to display the widgets, the theme files have to call the widget area function;

View::widget('body')

This is a minimum list that a theme should have for a better use of widgets and installed plugins and a guide where the View::widget({area}) should be placed in html

head Before the closing of the dead tag
body Right after the body tag opens
foot Inside the visible footer session of the page
column Inside the main column
post.after Just after the post session

A theme can make use of its own names for widget areas e.g. footer2, left-column but when the names are unique, switching in diferent themes the widgets must be updated with the new are names.

 

Subscribe to our newsletter