Opened 2 months ago
Closed 8 weeks ago
#23824 closed defect (bug) (wontfix)
Twenty Thirteen: Correct the hook on which twentythirteen_content_width is fired
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Bundled Theme | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | lancewillett, obenland, michael@… |
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)
Change History (15)
philiparthurmoore — 2 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().
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
Viper007Bond — 2 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
lancewillett — 2 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.
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
lancewillett — 2 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.
- Go to new post
- change it to image post format
- save post
- add media
- 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.
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.
Discussion: https://irclogs.wordpress.org/chanlog.php?channel=wordpress-dev&day=2013-03-21&sort=asc#m579207
Sorry to comment-bomb. My Trac mojo is off today.
comment:12
lancewillett — 8 weeks ago
See #23863 for filtering "content_width" differently for different post formats.
comment:13
lancewillett — 8 weeks 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
obenland — 8 weeks 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.

why you need width for the admin?