[theme-reviewers] Use of Action/Filter Hooks in WordPress Theme

Qamar Ashraf life.object at gmail.com
Tue Jul 26 13:08:36 UTC 2011


Hello,

I am going to share my WordPress Theme development logic for an expert
opinion. So it will help me and others in the WP theme development, Here is
a sample code of header template,

<?php do_action( 'chip_header_pre' ); ?>
>   <div id="header">
>     <div id="header-data">
>       <?php do_action( 'chip_header' ); ?>
>     </div> <!-- end #header-data -->
>   </div> <!-- end #header -->
> <?php do_action( 'chip_header_post' ); ?>



- I have written different modules like, Primary Menu, Secondary Menu etc.
- So i can easily attach these modules to any hook with add_action(),
depending on the requirement/presentation of a them/child theme.

*Child Theme A Example*

add_action('chip_header_pre', 'chip_primary_menu_init');
add_action('chip_header_post', 'chip_secondary_menu_init');

*Child Theme B Example*

add_action('chip_header_pre', 'chip_secondary_menu_init');
add_action('chip_header_post', 'chip_primary_menu_init');

Both of above child themes will have different presentation of menus, with
just a single line of code, and there may any other combination as well.

*So what is the recommendation of experts to have this logic ?*

-- 
Regards
Qamar Ashraf
www.tutorialchip.com
@lifeobject1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20110726/ed93759f/attachment.htm>


More information about the theme-reviewers mailing list