WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#18794 closed defect (bug) (fixed)

Twentyeleven templates do not properly call the loop

Reported by: jfarthing84 Owned by: westi
Milestone: 3.3 Priority: high
Severity: normal Version: 3.2.1
Component: Bundled Theme Keywords: has-patch
Focuses: Cc:

Description

Is there any particular reason that twentyeleven does not use a proper loop? Many (if not all) of the templates use

the_post()

rather than

if ( have_posts() ) : the_post();

thus defining $wp_query->in_the_loop as always true.

Attachments (1)

18794.diff (7.7 KB) - added by mfields 3 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 @nacin3 years ago

Some templates do indeed have this problem.

This is something we fixed with Twenty Ten, so it's rather annoying it got through again.

image.php, page.php, showcase.php, and sidebar-page.php are all affected. single.php is not, in particular.

Previously: #13279.

@mfields3 years ago

comment:2 @mfields3 years ago

  • Cc michael@… added
  • Keywords has-patch added

I uploaded 18794.diff which seems to fix this issue in all templates with partial loops. Please let me know if I missed anything.

comment:3 @SergeyBiryukov3 years ago

  • Component changed from Themes to Bundled Theme

comment:4 @lancewillett3 years ago

  • Cc lancewillett added

comment:5 @nacin3 years ago

  • Keywords dev-feedback removed
  • Milestone changed from Awaiting Review to 3.3
  • Priority changed from normal to high

comment:6 @iandstewart3 years ago

This looks good to me. Twenty Eleven on WP.com is already running the same code submitted by mfields.

comment:7 @westi3 years ago

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

In [19379]:

TwentyEleven: Always call the loop properly in all template files rather than just calling the_post(). Fixes #18794 props mfields.

Note: See TracTickets for help on using tickets.