0

In the requirements of Envato I saw that they require a $content_width to be set. I searched for it on the internet but can't really understand why?

I don't use it and the theme is responsive.

If I only declare the $content_width and never use it, what value should I give it?

1 Answer 1

3

$content_width is used to set the default width of embeds, for situations when an element needed to specify a width. This is how WP knew the width of the main content area.

However, this was back before the push for responsive design, and modern CSS with fluid embeds and responsive breakpoints. So it isn't needed much but it can still result in odd embeds if you set a bad value. Content width sometimes gets used in other edge cases too, but that was the main use case and its reason for being.

So I suggest:

  • Figure out the content width on the most common desktop resolution, and use it to set $content_width in functions.php
  • Then, apply CSS to adjust embeds responsively/fluidly as you would normally do
1
  • Hi! Sorry for the late reply and thanks for the answer!
    – ralphjsmit
    Commented Jun 5, 2020 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.