[theme-reviewers] $content_width and after_theme_setup: d'oh!

Chip Bennett chip at chipbennett.net
Sun Jan 16 01:46:35 UTC 2011


And yes, I meant "after_setup_theme".

I shouldn't try to compose emails while simultaneously giving the girls
baths...

Chip

On Sat, Jan 15, 2011 at 7:05 PM, Otto <otto at ottodestruct.com> wrote:

> Sorry, I meant "after_setup_theme". I always get that wrong.
>
> -Otto
>
>
>
> On Sat, Jan 15, 2011 at 8:04 PM, Otto <otto at ottodestruct.com> wrote:
> > Actually, I believe it only needs to be set globally. The easy way to
> > do this is to set it outside that hook, and that's what twentyten
> > does, but this would be equally valid:
> >
> > add_action('after_theme_setup','theme_setup');
> > function theme_setup() {
> >  global $content_width;
> >  if ( ! isset( $content_width ) )
> >    $content_width=640;
> > }
> >
> > Also equally valid would be to set $_GLOBALS['content_width'] = 640;
> > or similar. Same thing, really.
> >
> > However, for theme compatibility (and to allow child themes to
> > override it) the "if ( ! isset( $content_width ) )" should be used as
> > well.
> >
> > -Otto
> >
> >
> > On Sat, Jan 15, 2011 at 7:54 PM, Chip Bennett <chip at chipbennett.net>
> wrote:
> >> So, I just realized something today regarding setting $content_width: it
> >> must be set *before* the after_theme_setup hook.
> >> Just a mental note to myself, to check functions.php to ensure that the
> call
> >> to set $content_width isn't inside of a theme setup function that gets
> >> called on after_theme_setup. I thought I'd share that with everyone,
> just in
> >> case I'm not the only one who needed that clarification. :)
> >> Chip
> >> _______________________________________________
> >> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20110115/ec615860/attachment.htm>


More information about the theme-reviewers mailing list