11 thoughts on “Have you heard of WordPress $content_width? Leave a comment

  1. Pingback: BlogBuzz April 14, 2012
  2. Wow, I had never heard of that. $content_width sounds pretty darn handy, indeed! Thanks Ben.

  3. Sounds like a good plugin to try! Supporting all the required elements of wordpress is what we strive for especially when it comes to the design and layout of a website. This should make the job a little easier. I can also see the importance of the content width feature within wordpress especially if you intend on uploading a lot of photos to your website.

  4. Actually it is filterable: A parent themes functions.php loads before the child themes functions.php file. So if you’re setting if ( ! isset( $content_width ) ) $content_width = 123;, then it is overridable from within your child themes functions.php file.

      1. That doesn’t matter as you can simply hook in after the main theme has loaded.

  5. I’m finding this overrides the setting in Media Settings. That is, the largest image size available via “Add Image” corresponds to my $content_width, not to the Media Settings width.

    It’s a strange setting, me thinks, as it’s common for text to have different widths in different areas of a site. Not to mention Responsive designs. I’d prefer more granularity, such as the ability to set or override it per template, or even per block.

    1. Setting it per template is easy – just check what type of page it is and set the width accordingly. 🙂

  6. I have creating a Responsive theme for my client. How much width should be given for a responsive theme?

    1. Interesting question – I have the same issue when creating my own responsive sites.

      Normally when you make responsive sites you have a maximum content width – and when the width is likely to grow larger you alter the design – so I use the maximum size as the content_width

Leave a Reply

Your email address will not be published. Required fields are marked *