[wp-trac] [WordPress Trac] #21256: New theme feature - add_theme_support( 'content-width', $defaults )

WordPress Trac noreply at wordpress.org
Wed Feb 27 08:47:44 UTC 2013


#21256: New theme feature - add_theme_support( 'content-width', $defaults )
--------------------------------------+------------------------------
 Reporter:  ramiy                     |       Owner:
     Type:  feature request           |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Themes                    |     Version:  3.4.1
 Severity:  normal                    |  Resolution:
 Keywords:  dev-feedback 2nd-opinion  |
--------------------------------------+------------------------------

Comment (by ramiy):

 Ok, let's re-think '''$content_width''', and how we use it?

 ''Dashboard:''
 - Fullscreen editor default width.
 - Scaled down images in the editor.

 ''Themes:''
 - Set maximum allowed width for Embeds and Images in the content.
 - Use conditionals for different pages.

 ----

 I analyzed how different theme's use $content_width.

 In my themes, i use conditionals for '''post-types'''.

 Twenty Twelve uses conditionals for '''page-templates''' (wide screen):
 {{{
 if ( ! isset( $content_width ) )
         $content_width = 625;

 function twentytwelve_content_width() {
         if ( is_page_template( 'full-width-page.php' ) || is_attachment()
 ) {
                 global $content_width;
                 $content_width = 960;
         }
 }
 add_action( 'template_redirect', 'twentytwelve_content_width' );
 }}}

 Twenty Thirteen uses conditionals for '''post-formats''' (videos &
 images):
 {{{
 if ( ! isset( $content_width ) )
         $content_width = 604;

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

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21256#comment:28>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list