• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2662

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Videos
  • Log in

Premium Member? - Request custom code

Change Content Width For Embedded Media

Most child themes include code which determines the default embed sizes for videos and other embedded media.

You can also change these values or add your own which effect all media embeds globally.

Here’s an example of what you’ll find in all StudioPress child themes:

$content_width = apply_filters( 'content_width', 740, 740, 1140 );

And here’s some code you can add to other child themes:

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

You can also add a height to this code:

if ( ! isset( $content_width ) )
$content_width = 600;
$content_height = 300;

But what if you only want to change the embed size on one specific page or post? You can also do this using a custom function which includes a conditional tag.

Learn how to change the content width for media embeds conditionally

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems