Widgetizing application layouts

As mentioned earlier, we have the option of creating template files inside a theme or a plugin. Here, we are going to create the templates inside the plugins folder to improve flexibility. So, let's begin the process by creating another plugin named WPWA Theme Manager. Create a folder named wpwa-theme and define the main plugin file as class-wpwa-theme.php with the usual plugin definitions. Next, we can update the constructor code as follows to register the widgetized area for the home page:

class WPWA_Theme { public function __construct() { $this-> register_widget_areas(); } public function register_widget_areas() { register_sidebar(array('name' => __('Home Widgets','wpwa'),'id' => 'home-widgets','description' => ...

Get WordPress Web Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.