[theme-reviewers] Question about implementation of theme hooks / template tags system

Daniel Tara contact at onedesigns.com
Mon Mar 18 18:29:39 UTC 2013


I'd rather not discuss on that particular theme, but on mine. I personally don't like how that theme has implemented the hooks system. I agree that it's very limited in the way it was implemented. It's going through an if/elseif iteration of predefined conditionals and doesn't have a general else statement. This imposes limitations in that only that set of limited hooks will be used, there is for example no consideration for custom post types, taxonomies or terms. But besides from that, I don't think that the theme circumvents the Template Hierarchy directly. Those hooks are called in the function canvas() which is hard coded in the index.php file, which is already a template file, which means the Template Hierarchy has already been calculated. To invariably circumvent the Template Hierarchy that function would have been added to the 'template_redirect' hook, which would have indeed blocked the execution of the locate_template calls. But in the way this theme has done it, a category.php file can still be added to the theme and it would be loaded on category pages. The user would still have to make a call to the canvas() theme to take advantage of the hooks system but could otherwise be customized by preference. That is the way I interpret this issue, unless of course I'm missing something so please correct me if I'm wrong.

Daniel

On Mar 18, 2013, at 8:15 PM, Chip Bennett wrote:

> I think that the interpretation in the linked ticket is valid, and applies here:
> This implementation entirely circumvents the WordPress? Template Hierarchy, and adds its own, custom abstraction layer. Themes are required to support core functionality when integrating a given feature. I would suggest that this requirement extends to the template hierarchy itself.
> 
> You may want to look at a combination of template-part files and custom Theme hooks to accomplish the same thing that you're attempting to do here.
> 
> So, let's start the discussion there.
> 
> Is that interpretation correct? I I'm open to being convinced otherwise.
> 
> 
> On Mon, Mar 18, 2013 at 1:57 PM, Daniel Tara <contact at onedesigns.com> wrote:
> Hello Theme Reviewers Team,
> 
> I would like to receive clarification if a theming method I'm implementing is in compliance with the Theme Review Guidelines.
> 
> I'm currently building a theme framework that will serve as a base for all my future theme implementations. The framework consists of a series of common functions and template tags that are to be used inside templates. The functions are written in such way that they can be used as both hard coded template tags, with a set of predefined options that can be overridden by parameters and also to be used with a template hook system and their options can be modified via filters. I'm also planning to build a module that will allow control of the template hooks via conditionals and eventually integrate all this into a drag-and-drop module that will allow user customization of template tags locations.
> 
> I have taken the care to comply with all Theme Review Guidelines and WordPress Best Practices when coding this theme, including complying with the Template Hierarchy. The only template file a parent theme would need to work with this module is index.php with the template hooks included. Then, if a user wishes to add a template in a child theme, it will still be used for the corresponding query type and if the user adds the standard template hooks to the file then the framework's module would still work because the conditionals would return the corresponding values for the template and if not the template could still be customized by hard coding template tags.
> 
> I'm asking this question because a discussion that took place recently on the mailing list regarding a theme came to my attention, namely this one:
> 
> http://themes.trac.wordpress.org/ticket/10822
> 
> In the ticket it was argued that the way that theme was implementing its template hooks system was circumventing the Template Hierarchy and hard coding template files was recommended. I haven't examined that theme in detail because after a quick look the poor implementation of the feature was clear but it was still a template hooks system, so I felt the need to ask: is it theme review policy to strictly forbid a template hooks system and require the use of hard coded template files for any customization of WordPress-generated pages or was that something specific in the way that theme was implementing this feature that made it be rejected? If such a system is not allowed do you have recommendation of an accepted way to implement a module that allows user customization of page output?
> 
> An earlier version of the theme I'm talking about was already submitted to the directory, it was reviewed and not-approved for trivial reasons but the use of the template hooks system was not mentioned:
> 
> http://themes.trac.wordpress.org/ticket/11152
> 
> But since review of the theme I mentioned earlier has set a precedent I felt the need to ask. Since the theme above was submitted the theme has been under heavy development and much has changed but the way the template hooks system was implemented still stands. Eventually the hardcoded hooks at the end of the functions.php file will be replaced with the conditionals module I was talking about which is not yet developed. If needed I can send a current version of the theme so you can take a closer look.
> 
> Regards,
> Daniel
> 
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
> 
> 
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20130318/c3ec36fb/attachment.htm>


More information about the theme-reviewers mailing list