[wp-trac] [WordPress Trac] #15078: Custom Loops in Twenty Ten
WordPress Trac
wp-trac at lists.automattic.com
Sat Oct 9 09:39:21 UTC 2010
#15078: Custom Loops in Twenty Ten
------------------------------------+---------------------------------------
Reporter: koopersmith | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 3.1
Component: Themes | Version: 3.0.1
Severity: normal | Resolution: fixed
Keywords: has-patch dev-reviewed |
------------------------------------+---------------------------------------
Comment(by demetris):
@nacin
As I see it, a main/parent theme should never use both args of
{{{get_template_part}}} to specify its own template parts.
First, there is no reason to: A theme can, equally well, specify any file
it wants by using only the first argument.
Second, there is reason not to: By doing so, it denies child themes the
option to do something more specific for a template. So, it cancels the
granularity and flexibility that the second arg of {{{get_template_part}}}
gives us.
Why have a second argument in the first place if parent themes use it up
to do what they can very well do by using only one argument?
Given these two points, the options for organizing the loop code of Twenty
Ten are, I think, two:
First option:
Drop all loop code in one ''loop.php'' file, and then give options to
child themes by including ''loop.php'' like this:
{{{
get_template_part('loop', 'single');
get_template_part('loop', 'page');
get_template_part('loop', 'home');
get_template_part('loop', 'category');
etc. etc.
}}}
That, of course, would mean a large loop file with complex, difficult to
follow, flow control. (And maybe with a performance penalty too?)
Second option, not very backwards compatible maybe at this moment:
{{{
get_template_part('loop-archive', 'author');
get_template_part('loop-archive', 'category');
etc. etc.
get_template_part('loop-page', 'default');
get_template_part('loop-page', 'single-column');
etc. etc.
}}}
> With regards to why we need a proper loop, see #13279.
Aha! Thanks for reminding me of that.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/15078#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list