Support » Themes and Templates » $content_width in a responsive theme

  • What should I do about:

    code ‘if ( !isset( $content_width ) ) $content_width = 610;’

    when creating a responsive theme? Because there is no knowing what the width of the page will be.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Same question.

    anyone find out the solutions yet?
    having the same prob here 🙁



    Font hero

    $content_width only used in oEmbed. It determines the size of embed content like youtube.

    See functions.php of Twentytwelve on how to change $content_width based on theme layout.

    Yes, but what about responsive themes?



    Font hero

    I use this plugin with great result.

    Responsive Video Embeds

    There is also JS solution fitvids.js, but I prefer non JS



    Forum Moderator

    responsive themes usually have a max width – adjust the $content_width to fit that max width; smaller screen sizes should then adjust automatically.

    I’m not sure I’m following you @alchymyth. Could you explain in more detail?

    It seems like there should be a way to set $content_width to a max pixel width, but still have it responsive to the available space. However, I haven’t been able to find anything that explains how you’d go about doing this.

    EDIT: found some agrement that this sucks:

    I also found out the 2012 theme makes the new WP 3.6 player very responsive. It’s not a problem there. But I can’t find anything about how they did it. And the YouTube player is not very responsive, the width of the video player changes, and the video itself resizes nicely, but the height of the player doesn’t change (at least when dragging the browser size).

    I have the same question. And I found one more anoying thing, I set in media preferences 2 sizes for the images (Medium and Large), but as i have a responsive theme and want to supply 2x images for retina displays my images are double in size, so my Large image size is 1600px and then with css is set to 50% of this size to look as 800px. I found that if I have a $content_width= 900 the size Large is no longer 1600px, is automatically set to 900, the medium size is not modified and is 1200px (bigger than the content–width). So i removed the $content_width function…

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘$content_width in a responsive theme’ is closed to new replies.