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

WordPress Trac noreply at wordpress.org
Sat Apr 28 18:01:55 UTC 2018


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

Comment (by markcallen):

 I'm not so sure about `add_theme_support` here, any defined list of
 arguments is entirely subjective and could be based on any number of
 factors

 * Screen size (unknown at the time of generation anyway)
 * Post type as inferred by the OP
 * Template
 * Post format
 * Taxonomy, date, author pages
 * Something I haven't thought of

 It's inappropriate in my opinion for core to try and make assumptions
 about any possible layout conditions in a theme and define a list of
 arguments for theme.

 This is why a simple filter value makes most sense to me. e.g.

 `apply_filters( 'content_width', $content_width );`

 Theme devs can then add filters as simple or complicated as necessary to
 get the right value out. It removes the need for hooking into
 `template_redirect`, because it can be hooked directly and appropriately.

 The definition in themes then becomes the default value and allows
 flexibility.

 Ultimately, the continued existence of `$content_width` should really be
 challenged. Anyway you look at it, it shouldn't have a long term future.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/21256#comment:53>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list