WordPress.org

Ready to get started?Download WordPress

Codex

Content Width

Content Width is a theme feature, first introduced in Version 2.6. Using this feature you can set the maximum allowed width for any content in the theme, like oEmbeds and images added to posts.

Using this theme feature, WordPress can scale oEmbed code to a specific size (width) in the front-end, and insert large images without breaking the main content area. Also, using this feature you lay the ground for other plugins to perfectly integrate with any theme, since plugins can access the value stored in $content_width.

Contents

Adding Theme Support

Since Version 2.6, themes need to specify the $content_width variable in the functions.php file, like so:

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

It's also recommended to add the following CSS to your theme:

.size-auto, 
.size-full,
.size-large,
.size-medium,
.size-thumbnail {
	max-width: 100%;
	height: auto;
}

Future Development

Resources

Related

Theme Support: add_theme_support(), remove_theme_support(), current_theme_supports()
Features: sidebar, menus, post-formats, post-thumbnails, custom-background, custom-header, automatic-feed-links, content_width, editor-style, html5