Planning action hooks for layouts

Usually, WordPress theme developers build template files using unique designs and place the action hooks afterwards; these hooks are mainly placed before and after the main content of the templates. This technique works well for designing themes for websites. But 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'); ...

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.