Planning action hooks for layouts
Usually, WordPress theme developers build template files using unique designs and place the action hooks later. These hooks are mainly placed before and after the main content of the templates. This technique works well for designing themes for websites. However, a web application requires flexible templates, and hence, we should be focusing on optimizing the flexibility as much as possible. So, the planning of hook points needs to be done prior to designing. Consider the following sample template code of a typical structure of a hook-based template:
<?php do_action('before_menu'); ?> <div class='menu'> <div class='menu_header'>Header</div> <ul> <li>Item 1</li> <li>Item 2</li> </ul> </div> <?php do_action('after_menu'); ?>
The preceding code is well structured for extending purposes using action hooks. However, we can only add new content before and after the menu container...