<div>In my opinion, I believe the Action approach is easier for developers while the Simple approach is easier for your average end-user. The question you should ask is "who are you building this theme for?" Answer that and code it accordingly.</div>
<br clear="all">Josh<br>
<br><br><div class="gmail_quote">On Tue, Jul 26, 2011 at 9:30 AM, Qamar Ashraf <span dir="ltr"><<a href="mailto:life.object@gmail.com">life.object@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Thanks Chip,<div><br></div><div>I also love hooks and <b>Oenology 2.0</b> is an excellent example of hooks. But i am also thinking about end-user flexibility who have not much more idea about using them. So, i was thinking about the complexity of code before submitting to the WordPress directory. Okay, what you prefer in the following two code snippets in terms of,</div>
<div><ul><li>Simplicity for End Users who have little idea about Child Themes.</li><li>Code efficiency.</li></ul></div><div><b>1. Action Approach:</b></div><div><br></div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">
<span style="border-collapse:collapse;color:rgb(51, 51, 51);font-family:arial, sans-serif;font-size:13px"><?php do_action( 'chip_header_pre' ); ?></span><span style="border-collapse:collapse;color:rgb(51, 51, 51);font-family:arial, sans-serif;font-size:13px"><br>
</span><span style="border-collapse:collapse;color:rgb(51, 51, 51);font-family:arial, sans-serif;font-size:13px"> <div id="header"><br></span><span style="border-collapse:collapse;color:rgb(51, 51, 51);font-family:arial, sans-serif;font-size:13px"> <div id="header-data"><br>
</span><span style="border-collapse:collapse;color:rgb(51, 51, 51);font-family:arial, sans-serif;font-size:13px"> <?php do_action( 'chip_header' ); ?> <span style="white-space:pre-wrap">        </span> <br>
</span><span style="border-collapse:collapse;color:rgb(51, 51, 51);font-family:arial, sans-serif;font-size:13px"> </div> <!-- end #header-data --><br></span><span style="border-collapse:collapse;color:rgb(51, 51, 51);font-family:arial, sans-serif;font-size:13px"> </div> <!-- end #header --><br>
</span><span style="border-collapse:collapse;color:rgb(51, 51, 51);font-family:arial, sans-serif;font-size:13px"><?php do_action( 'chip_header_post' ); ?></span></blockquote>
<div><br></div><div><b>2. Simple Approach:</b></div><div><br></div><div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">
<?php get_template_part( 'nav', 'primary' ); ?><br> <div id="header"><br> <div id="header-data"><br> <?php get_template_part( 'header', get_chip_header_format() ); ?><br>
<div class="clear"></div><br> </div> <!-- end #header-data --><br> </div> <!-- end #header --><br><?php get_template_part( 'nav', 'secondary' ); ?></blockquote>
</div><div><br></div><div><br></div><div>You can guess better the complexity of hooks in the loop :)</div><div><br></div><div>Regards</div><div><br><br><div class="gmail_quote">On Tue, Jul 26, 2011 at 7:14 PM, Chip Bennett <span dir="ltr"><<a href="mailto:chip@chipbennett.net" target="_blank">chip@chipbennett.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Personally, I think action/filter hooks are Teh Awesome. <a href="https://github.com/chipbennett/oenology/blob/master/functions/hooks.php" target="_blank">I also use them, quite extensively</a>.<div>
<br></div><div>But I'm not really sure what you're asking?</div>
<div><br></div><div>Are they acceptable? Of course; provided they are implemented properly, per the appropriate API conventions.</div><div><br></div><div>Are they best practice? In my personal opinion, they are; I prefer them to, e.g. pluggable functions. But at least currently, the Guidelines are silent on custom hooks.</div>
<div><br></div><div>(p.s. you should prefix your hooks with theme_slug, or at the very least, make sure your hook-name prefixes are consistent with the rest of the Theme - which, IIRC, is Chip Life, or "chip_life" as a prefix?)</div>
<div><br></div><div>Chip<br><br><div class="gmail_quote"><div><div></div><div>On Tue, Jul 26, 2011 at 8:08 AM, Qamar Ashraf <span dir="ltr"><<a href="mailto:life.object@gmail.com" target="_blank">life.object@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div>
Hello,<div><br></div><div>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,</div><div><br>
</div>
<div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">
<?php do_action( 'chip_header_pre' ); ?><br> <div id="header"><br> <div id="header-data"><br> <?php do_action( 'chip_header' ); ?> <span style="white-space:pre-wrap">        </span> <br>
</div> <!-- end #header-data --><br> </div> <!-- end #header --><br><?php do_action( 'chip_header_post' ); ?></blockquote></div><div><br></div><div><br></div><div>- I have written different modules like, Primary Menu, Secondary Menu etc.</div>
<div>- So i can easily attach these modules to any hook with add_action(), depending on the requirement/presentation of a them/child theme. </div><div><br></div><div><b>Child Theme A Example</b></div><div><br></div><div>
add_action('chip_header_pre', 'chip_primary_menu_init');</div>
<div>add_action('chip_header_post', 'chip_secondary_menu_init');</div><div><br></div><div><div><b>Child Theme B Example</b></div><div><br></div><div><span>add_action('chip_header_pre', '</span>chip_secondary_menu_init<span>');</span></div>
<div>add_action('chip_header_post', 'chip_primary_menu_init');</div></div><div><br></div><div>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.</div>
<div><br></div><div><b>So what is the recommendation of experts to have this logic ?</b></div><div><br>-- <br><font color="#666666">Regards</font><div><font color="#666666">Qamar Ashraf</font></div><div><font color="#666666"><a href="http://www.tutorialchip.com" target="_blank">www.tutorialchip.com</a></font></div>
<div><font color="#666666">@lifeobject1</font></div><br>
</div>
<br></div></div>_______________________________________________<br>
theme-reviewers mailing list<br>
<a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
theme-reviewers mailing list<br>
<a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><font color="#666666">Regards</font><div><font color="#666666">Qamar Ashraf</font></div><div><font color="#666666"><a href="http://www.tutorialchip.com" target="_blank">www.tutorialchip.com</a></font></div>
<div><font color="#666666">@lifeobject1</font></div><br>
</div>
<br>_______________________________________________<br>
theme-reviewers mailing list<br>
<a href="mailto:theme-reviewers@lists.wordpress.org">theme-reviewers@lists.wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
<br></blockquote></div><br>