WordPress.org

Make WordPress Core

#23824 closed defect (bug) (wontfix)

Twenty Thirteen: Correct the hook on which twentythirteen_content_width is fired

Reported by: 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 13 months ago.

Download all attachments as: .zip

Change History (15)

comment:1 follow-up: alexvorn213 months ago

why you need width for the admin?

comment:2 mfields13 months 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().

comment:3 mfields13 months ago

  • Cc michael@… added

comment:4 in reply to: ↑ 1 ; follow-ups: DrewAPicture13 months 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.

comment:5 in reply to: ↑ 4 Viper007Bond13 months 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).

comment:6 lancewillett13 months 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.

comment:7 in reply to: ↑ 4 alexvorn213 months 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? :)

comment:8 lancewillett13 months 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.

comment:9 philiparthurmoore13 months 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.

comment:10 philiparthurmoore13 months 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.

comment:12 lancewillett13 months ago

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

comment:13 lancewillett13 months 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.

comment:14 obenland13 months 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.