[theme-reviewers] Setting $content_width Dynamically

Otto otto at ottodestruct.com
Wed Aug 10 18:46:36 UTC 2011


Consistency is something that happens to other people.

The $content_width is actually used for a lot of things. It also
controls the width of the fullscreen editor, for example. It also
controls the width used for oembed requests. It controls the maximum
value of the "large" image size when displayed in the editor.

So it definitely needs to be set globally. In fact, it probably only
needs to be set in the admin side, I don't think it has much if any
effect on the public facing side of the site. Although I'm not sure
about that, especially for the oembeds case.

-Otto



On Wed, Aug 10, 2011 at 1:35 PM, Chip Bennett <chip at chipbennett.net> wrote:
> So what would be best practice here? Perhaps setting it separately for
> is_admin(), and using the largest $content_width value? Perhaps hooking it
> into admin_init?
> Also: why is $content_width used on *insertion*, yet controlled by the
> *Theme*? That isn't intuitive. And, wouldn't it potentially introduce issues
> whenever the Theme is changed *after* insertion?
> Chip
>
> On Wed, Aug 10, 2011 at 10:22 AM, Otto <otto at ottodestruct.com> wrote:
>>
>> I've tried this sort of thing, and it is *fraught* with peril.
>>
>> Make sure you test inserting content into various posts and pages and
>> such thoroughly. The content width is used on content insertion, not
>> just on content display.
>>
>> Basically, the media uploader expects the content width to be set when
>> images are uploaded and resized. If you're only setting it on wp_head,
>> your results may be unexpected for various size values in the media
>> section.
>>
>> -Otto
>> _______________________________________________
>> theme-reviewers mailing list
>> theme-reviewers at lists.wordpress.org
>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>


More information about the theme-reviewers mailing list