Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#13279 closed defect (bug) (fixed)

single.php in twentyten doesn't use `get_template_part()` to choose the loop template and breaks `in_the_loop` checks

Reported by: shawnparker's profile shawnparker Owned by:
Milestone: 3.0 Priority: high
Severity: normal Version: 3.0
Component: Themes Keywords:
Focuses: Cc:

Description

Is there any specific reason why?

The current way that single.php is built negates using in_the_loop to detect whether we're in a loop context or not. This causes sidebars to think that they're in the loop. It seems like it would also have a detrimental effect on the new design scheme for implementing child themes.

A simple switch to using get_template_part('loop', 'single'); inside the single template appears to work fine, but I haven't done any serious debugging yet.

There are minor verbiage changes in the post-meta display between single.php as it is and loop.php.

I'm interested to know if this was an oversight or if it was a conscious decision (and what the reasoning was).

Change History (4)

#1 @nacin
15 years ago

  • Keywords reporter-feedback close added; twentyten get_template_part in_the_loop removed

There are some rather significant differences between loop.php (the final branch of code) and single.php. To merge them, we'd be making loop.php even more choppy than it already is.

As of right now, I'm -1, though it wouldn't hurt to see a diff.

#2 @shawnparker
15 years ago

At the very least then there should be a valid loop in single.php so that single.php isn't broken and we (plugin developers) can do loop detection. That is certainly the path of least resistance if merging the two is too tedious.

I'll work up a diff for both ways a little later on.

#3 @nacin
15 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [14476]) In Twenty Ten, give single.php a valid loop. fixes #13279.

#4 @nacin
15 years ago

  • Keywords reporter-feedback close removed
  • Milestone changed from Unassigned to 3.0

I hadn't noticed that previously. I just went through about three dozen wp.com themes and all but one had a proper loop in single.php, so I'm adding it here.

I don't think merging single.php into loop.php is a particularly good idea due to the differences, so I'm closing this as fixed.

Note: See TracTickets for help on using tickets.