[theme-reviewers] content_width in variable-width themes

Chip Bennett chip at chipbennett.net
Wed Jan 25 22:54:31 UTC 2012


I'm not aware of any consensus *best* practice for dynamic content-width;
however, I use a method in Oenology that works, and has thus far been
robust, for setting $content_width dynamically according to the selected
layout (full, one-column, two-column, three-column, etc.). Here's the
function:
https://github.com/chipbennett/oenology/blob/master/functions/theme-setup.php#L33

Note that I hook the function both into wp_head with a priority of 0, and
also into admin_head (so that it applies to the post editor).

(If anyone has any ideas for improving the implementation, or has any ideas
for a better practice altogether, I'll be happy to modify.)

Chip

On Wed, Jan 25, 2012 at 4:41 PM, Kirk Wight <kwight at kwight.ca> wrote:

> It seems $content_width has to be in pixels, so unless it's set very
> small, it's conceivable that the embed test in the Theme Unit Test will
> overflow the content area at some point.
>
> What is the best method for setting $content_width in a variable-width
> theme?
>
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20120125/0211a1e7/attachment.htm>


More information about the theme-reviewers mailing list