O'Reilly logo

WordPress Web Application Development - Second Edition by Rakhitha Nimesh Ratnayake

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Widgetizing application layouts

As mentioned earlier, we have the option of creating template files inside a theme or a plugin. Here, we will create the templates inside the plugins folder to improve flexibility. So, let's begin the process by creating a file called class-wpwa-theme.php within the root directory of our main plugin and including it in the class-wpwa-portfolio-manager.php file. 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' => __('Home Widget Area', 'wpwa'), ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required