Give help. Get help.

  • # December 18, 2012 at 7:44 pm

    I’m designing a responsive theme for WordPress and I don’t know what to do about the $content_width variable. as the width would depend on the viewport. Does anybody know what I should do?

    # December 18, 2012 at 8:07 pm

    I believe, and I may be wrong, $content_width in WordPress is a way to set the max width of images.

    If you’re using responsive design techniques, what you could do is simply override the standard image width/height markup using CSS.

    For example, setting a max-width of a particular amount, or indeed 100% – with height set to auto, that way you know that the images will never expand beyond their container, so when downsizing they will adjust to fit automagically.

    # December 19, 2012 at 5:11 am

    Yes Andy, that’s exactly what I do with images. I too have read “rumours” of it being used to stop images overflowing, but it is so poorly documented. I thought I could just leave it out so I ran the theme-tester plugin after removing the:

    if ( !isset( $content_width ) ) $content_width = 610;

    and it threw up an error stating that the line was required so I don’t know what to do now.

    # December 19, 2012 at 3:45 pm

    Thx ChrisP, but I’m already doing that. It’s the $content_width variable and setting (or not) it’s value.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.