Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#23824 closed defect (bug) (wontfix)

Twenty Thirteen: Correct the hook on which twentythirteen_content_width is fired

Reported by: philiparthurmoore's profile philiparthurmoore Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords:
Focuses: Cc:

Description

Using template_redirect for content width readjustment works fine on the front end, but it fails in the admin.

Change the hook on which twentythirteen_content_width fires to after_setup_theme instead so that recalculation works on both ends of a user's blog.

Attachments (1)

alter-content-width-fire (505 bytes) - added by philiparthurmoore 12 years ago.

Download all attachments as: .zip

Change History (15)

#1 follow-up: @alexvorn2
12 years ago

why you need width for the admin?

#2 @mfields
12 years ago

after_setup_theme is too early to dynamically set the value of $content_width for Twenty Thirteen. twentythirteen_content_width() calls two conditional functions which always return false if used before the query is processed these functions are has_post_format() and is_attachment().

#3 @mfields
12 years ago

  • Cc michael@… added

#4 in reply to: ↑ 1 ; follow-ups: @DrewAPicture
12 years ago

Replying to alexvorn2:

why you need width for the admin?

$content_width also controls the content width in the TinyMCE editor so you that it can accurately portray how it will be displayed on the front end.

#5 in reply to: ↑ 4 @Viper007Bond
12 years ago

Replying to DrewAPicture:

Replying to alexvorn2:

why you need width for the admin?

$content_width also controls the content width in the TinyMCE editor so you that it can accurately portray how it will be displayed on the front end.

It can also be used to control things like thumbnail size (we do this on WordPress.com).

#6 @lancewillett
12 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 3.6

Used also in Media, when you select the size to insert an image to a post or page.

#7 in reply to: ↑ 4 @alexvorn2
12 years ago

Replying to DrewAPicture:

Replying to alexvorn2:

why you need width for the admin?

$content_width also controls the content width in the TinyMCE editor so you that it can accurately portray how it will be displayed on the front end.

For that we use editor-style.css, no? :)

#8 @lancewillett
12 years ago

  • Keywords reporter-feedback added

Is there a specific example where this fails in admin with Twenty Thirteen? Just want to be able to test and make a smart choice.

#9 @philiparthurmoore
12 years ago

  1. Go to new post
  2. change it to image post format
  3. save post
  4. add media
  5. full size should be set to 724px but it's set to 604px

Definitely okay with leaving the theme as-is due to mfields' comments above.

#10 @philiparthurmoore
12 years ago

obenland also made a good point in IRC:

post formats will use the new API - no content-width necessary

So if has_post_format( 'image' ) || has_post_format( 'video' ) is eventually removed from twentythirteen_content_width due to post format API changes then leaving template_redirect should be fine, since we only care about an attachment's content width on the front when it's being viewed.

#12 @lancewillett
12 years ago

See #23863 for filtering "content_width" differently for different post formats.

#13 @lancewillett
12 years ago

  • Keywords close added; needs-patch reporter-feedback removed

Suggest wontfix for this, we're using a custom image size for Image post format now.

#14 @obenland
12 years ago

  • Keywords close removed
  • Milestone 3.6 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Agreed. Maybe #21256 can provide an end-to-end solution.

Note: See TracTickets for help on using tickets.