0

I'm thinking about setting the content width theme feature in my theme's functions.php file using:

if ( ! isset( $content_width ) ) {
    $content_width = 600;
}

My understanding is this will set the max allowed width for any text and images in my theme.

My layout is rather fluid (I don't have a fixed width) so would like to use a percentage value. How can I set the max content width to 100%?

Ref: https://codex.wordpress.org/Content_Width

0

$content_width is a global variable that can indeed be used by themes and plugins to set a maximum width on content elements. Therefore it's always a fixed value in pixels. The plugins don't know about your css.

However, this does not limit your possibilities in your theme. You can still set image sizes larger than $content_width and use them. Keeping the theme fluid is a matter of css.

The thing you'll find is that embeds (amongst others) use $content_width to determine their max width. So make sure that it is larger than the max column in your site if you want it to fit neatly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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