[wp-trac] [WordPress Trac] #23863: Post Formats: allow filtering content_width per format in wp-admin

WordPress Trac noreply at wordpress.org
Mon Mar 25 20:55:33 UTC 2013


#23863: Post Formats: allow filtering content_width per format in wp-admin
--------------------------+--------------------------
 Reporter:  lancewillett  |       Type:  defect (bug)
   Status:  new           |   Priority:  normal
Milestone:  3.6           |  Component:  Media
  Version:                |   Severity:  normal
 Keywords:  needs-patch   |
--------------------------+--------------------------
 On front-end a theme can filter {{{$content_width}}} like so:

 {{{
 function twentythirteen_content_width() {
         if ( has_post_format( 'image' ) || has_post_format( 'video' ) ) {
                 global $content_width;
                 $content_width = 724;
         }
 }
 add_action( 'init', 'twentythirteen_content_width' );
 }}}

 But ... functions called in wp-admin that use the global
 {{{$content_width}}} variable won't be changed.

 For example, using trunk and Twenty Thirteen theme:

 1. Create a new post, set to Image post format
 2. Click Add Media to insert an image
 3. Upload an image at least 800 px wide
 4. You'll see in "Attachment Display Settings" that width for the "large"
 size to insert to the post is 604 pixels and not 724.

 Also, even if detecting a Post Format this way worked correctly on edit,
 it wouldn't work on first post creation because of how the UI uses JS to
 switch between the formats.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23863>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list