WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#21711 closed enhancement (wontfix)

Twenty Twelve: use get_queried_object instead of the_post/rewind_posts in author archives

Reported by: kovshenin Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: has-patch
Focuses: Cc:

Description

Hi there! I think it's easier and more correct to use a proper WP_User object in the author archives with get_queried_object, instead of "hacking" it with the_post and rewind_posts. The only drawback is that it's not being passed through the_author filter, but I think that's fine, because technically we're not in a loop anyway, and thus, should not use the_author_* functions either.

It's the same approach I'd use for tag and category archives, but luckily, single_term_title wraps the call to get_queried_object and does most of the work for us.

Attachments (2)

21711.diff (2.5 KB) - added by kovshenin 3 years ago.
Uses get_queried_object instead of the_post/rewind_posts in author.php
21711.2.diff (2.4 KB) - added by kovshenin 3 years ago.
Minor: no need for isset on author description, thanks SergeyBiryukov

Download all attachments as: .zip

Change History (8)

@kovshenin3 years ago

Uses get_queried_object instead of the_post/rewind_posts in author.php

comment:1 @kovshenin3 years ago

If this works, Twenty Eleven and Twenty Ten can benefit from a similar change.

comment:2 @SergeyBiryukov3 years ago

  • Keywords has-patch added

if ( isset( $author->description ) && ! empty( $author->description ) )

! empty() would be enough.

@kovshenin3 years ago

Minor: no need for isset on author description, thanks SergeyBiryukov

comment:3 @scribu3 years ago

  • Milestone changed from Awaiting Review to 3.5

comment:4 follow-up: @lancewillett3 years ago

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

Discussed today in bug scrub, IRC #wordpress-dev.

See full log: https://irclogs.wordpress.org/chanlog.php?channel=wordpress-dev&day=2012-08-30&sort=asc#m448229

Template tags and rewind_posts() are working fine, here. Filters are good, too.

comment:5 @SergeyBiryukov3 years ago

  • Milestone 3.5 deleted

comment:6 in reply to: ↑ 4 @kovshenin3 years ago

Replying to lancewillett:

Thanks so much for the feedback! I still feel like entering and rewinding the loop is not the most elegant approach, but yours, nacin's and obenland's arguments make sense. Thanks again :)

Note: See TracTickets for help on using tickets.