Book Image

WordPress Web Application Development

By : Rakhitha Nimesh Ratnayake
Book Image

WordPress Web Application Development

By: Rakhitha Nimesh Ratnayake

Overview of this book

Table of Contents (19 chapters)
WordPress Web Application Development Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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'), 'before_widget' => '<div id="one" class="home_list">',
      'after_widget' => '</div>',
      'before_title' => '<h2>',
      'after_title' => '</h2>'
    ));
 ...