[theme-reviewers] Template hierarky

Chip Bennett chip at chipbennett.net
Wed Feb 27 01:40:32 UTC 2013


I still see what's being done here as the creation of an entirely separate
abstraction layer from the Template Hierarchy.

The canvas() function basically re-invents the wheel already found in
wp-includes/template-loader.php. The canvas_{context}.php files re-invent
the wheels already found in wp-includes/template.php.

Instead of going that route, just add the following template files to the
Theme:

home.php
single.php
archive.php
search.php
404.php
page.php
index.php

Then, inside of each of those files, call the appropriate code inside your
canvas_{context}.php files.

e.g. home.php would look like:

/**
 * Blog posts index template
 */

canvas_header();

do_action('canvas_nine');

do_action('canvas_masthead');

do_action('canvas_site_title');

do_action('canvas_description');

do_action('canvas_headerimage');

do_action('canvas_header_close');

if ( have_posts() ) : while ( have_posts() ) : the_post();

	do_action('canvas_article_postclass');

	the_post_thumbnail(); 			

	do_action('canvas_permalink');

	the_content( __( '<span class="clear">Continue reading
&rarr;</span>', 'canvas' ) );

	canvas_info();									

	do_action('canvas_close_articletag');

	do_action('canvas_clearfix');

	endwhile;

else:

	canvas_post_notfound();	

endif;

canvas_content_navi();

do_action('canvas_closediv');

do_action('canvas_thre');

do_action('canvas_asidebar');

do_action('canvas_closediv');

do_action('canvas_closediv');

do_action('canvas_footer_sidebar');

canvas_footer();


Along the same lines, take the code from canvas_header(), put it into
header.php, and include it via get_header(). Do likewise with
canvas_footer(). Include the main sidebar via get_sidebar().

I think, at that point, you'd have everything back within the core-defined
abstraction layer (i.e. the template hierarchy), and you'd be using
template files and including template parts as specified in the Guidelines.

(Suggestion, though: many of those blocks of do_action() calls are
repeated, and it might be a good idea to put them into template-part files
of their own, called via get_template_part().)

Regards,

Chip


On Tue, Feb 26, 2013 at 1:46 AM, hal-android <hasilent00 at gmail.com> wrote:

> Thanks otto,
> Maybe I can only suggest to avoid confusion wordpress themes
> development at this point:
>
> http://codex.wordpress.org/Theme_Review#Theme_Template_Files
>
> In this theme I was just trying to introduce something different, or
> maybe this is normal. I understand this theme is difficult but the
> user needs to know the different themes, here the user to learn about
> and how.
>
> I am aware of is the number one user must be given a strict assertion
> that we should not confuse to make a wordpress theme I was just trying
> to follow what is given here:
>
> http://codex.wordpress.org/Theme_Review#Theme_Template_Files
> _______________________________________________
> 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/20130226/36d764cc/attachment.htm>


More information about the theme-reviewers mailing list