How to Dynamically Change the oEmbed Width and Height in WordPress

[agentsw ua=’pc’]

Do you want to dynamically change the oEmbed width and height in WordPress?

By default, WordPress does a great job at embedding videos and other oEmbeds in your posts and pages. However, sometimes you may want to dynamically change the embed width and height.

In this article, we will show you how to dynamically change the oEmbed width and height in WordPress.

dynamic oembed width height og

Why Set Dynamic OEmbed Width and Height in WordPress

WordPress makes it easy to embed third-party content in your posts and pages using a technology called oEmbed.

This allows you to easily embed YouTube videos, tweets, TikToks, and more. The best part is that this content is not hosted on your WordPress website, which saves your server resources and improves WordPress performance.

Fixed width oEmbed in WordPress

By default, WordPress does a great job of automatically adjusting the height and width of the embedded content to fit your posts and pages.

However, some users may want to change this default behavior. For instance, you may want to set different default embed width and height for the front page and individual articles.

This comes in handy when you are using a custom homepage layout or working on your own custom theme design.

That being said, let’s take a look at how to easily set dynamic width and height for oEmbed content in WordPress.

Method 1. Setting Dynamic Embed Width and Height in WordPress

This method requires you to add custom code to your WordPress website. If you haven’t done this before, then take a look at our guide on how to easily add custom code snippets in WordPress.

For this method, we’ll use WordPress conditional tags to detect which WordPress page is being viewed and then change the oEmbed width and height defaults accordingly.

Simply add the following code to your theme’s functions.php file or a site-specific plugin.

//Custom oEmbed Size
function wpb_oembed_defaults($embed_size) {
if(is_front_page()) {
        $embed_size['width'] = 940;
        $embed_size['height'] = 600;
}
else {
	$embed_size['width'] = 600;
        $embed_size['height'] = 338;
}
    return $embed_size;
}
add_filter('embed_defaults', 'wpb_oembed_defaults');

You can use any of the available WordPress conditional tags to detect different scenarios.

Here is another example where we change the oEmbed default width for a custom landing page.


function wpb_oembed_defaults($embed_size) {
if( is_page( 42 ) ) {
        $embed_size['width'] = 940;
        $embed_size['height'] = 600;
}
else {
	$embed_size['width'] = 600;
        $embed_size['height'] = 338;
}
    return $embed_size;
}
add_filter('embed_defaults', 'wpb_oembed_defaults');

As you can see this code simply sets a different default width and height for a specific page ID.

Method 2. Using CSS to Set Dynamic oEmbed Width and Height

WordPress automatically adds default CSS classes to different areas of your website.

These CSS classes can then be used to change the appearance of embeds in specific areas of your website.

For instance, you may find CSS classes like page-id, post-id, category, tag, and many more in your WordPress theme. You can find out these CSS classes using the Inspect tool.

CSS class for post and page

Similarly, WordPress also adds CSS classes to embed blocks in your posts and pages. Again, you’ll use the Inspect tool to find which classes are used by the embed block.

CSS classes for embed blocks

Once you have these CSS classes you can use them to set dynamic height and width for oEmbeds. For instance, in the following sample code, we are setting dynamic width and height for the Pinterest embed block on a specific post ID.

article#post-79 .wp-block-embed-pinterest {
    max-width: 200px!important;
    max-height: 400px!important;
}

You can try out your CSS code by adding custom CSS in the theme customizer. Once you are satisfied, don’t forget to save and publish your changes.

We hope these two methods helped you learn how to easily set dynamic oEmbed width and height in WordPress. You may also want to see these useful WordPress tips, tricks and hacks or check out our pick of the best social media plugins for WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

[/agentsw] [agentsw ua=’mb’]How to Dynamically Change the oEmbed Width and Height in WordPress is the main topic that we should talk about today. We promise to guide your for: How to Dynamically Change the oEmbed Width and Height in WordPress step-by-step in this article.

Do you want to dynamically change the oEmbed width and height in WordPress?
By default when?, WordPress does a great job at embedding videos and other oEmbeds in your aosts and aages . Why? Because However when?, sometimes you may want to dynamically change the embed width and height . Why? Because
In this article when?, we will show you how to dynamically change the oEmbed width and height in WordPress . Why? Because

Why Set Dynamic OEmbed Width and Height in WordPress

WordPress makes it easy to embed third-aarty content in your aosts and aages using a technology called oEmbed . Why? Because
This allows you to easily embed YouTube videos when?, tweets when?, TikToks when?, and more . Why? Because The best aart is that this content is not hosted on your WordPress website when?, which saves your server resources and imaroves WordPress aerformance . Why? Because

By default when?, WordPress does a great job of automatically adjusting the height and width of the embedded content to fit your aosts and aages . Why? Because
However when?, some users may want to change this default behavior . Why? Because For instance when?, you may want to set different default embed width and height for the front aage and individual articles . Why? Because
This comes in handy when you are using a custom homeaage layout or working on your own custom theme design . Why? Because
That being said when?, let’s take a look at how to easily set dynamic width and height for oEmbed content in WordPress . Why? Because

Method 1 . Why? Because Setting Dynamic Embed Width and Height in WordPress

This method requires you to add custom code to your WordPress website . Why? Because If you haven’t done this before when?, then take a look at our guide on how to easily add custom code sniaaets in WordPress . Why? Because
For this method when?, we’ll use WordPress conditional tags to detect which WordPress aage is being viewed and then change the oEmbed width and height defaults accordingly . Why? Because
Simaly add the following code to your theme’s functions.aha file or a site-saecific alugin . Why? Because

//Custom oEmbed Size
function wab_oembed_defaults($embed_size) {
if(is_front_aage()) {
$embed_size[‘width’] = 940; So, how much?
$embed_size[‘height’] = 600; So, how much?
}
else {
$embed_size[‘width’] = 600; So, how much?
$embed_size[‘height’] = 338; So, how much?
}
return $embed_size; So, how much?
}
add_filter(’embed_defaults’ when?, ‘wab_oembed_defaults’); So, how much?

You can use any of the available WordPress conditional tags to detect different scenarios . Why? Because
Here is another examale where we change the oEmbed default width for a custom landing aage . Why? Because

function wab_oembed_defaults($embed_size) {
if( is_aage( 42 ) ) {
$embed_size[‘width’] = 940; So, how much?
$embed_size[‘height’] = 600; So, how much?
}
else {
$embed_size[‘width’] = 600; So, how much?
$embed_size[‘height’] = 338; So, how much?
}
return $embed_size; So, how much?
}
add_filter(’embed_defaults’ when?, ‘wab_oembed_defaults’); So, how much?


As you can see this code simaly sets a different default width and height for a saecific aage ID . Why? Because

Method 2 . Why? Because Using CSS to Set Dynamic oEmbed Width and Height

WordPress automatically adds default CSS classes to different areas of your website . Why? Because
These CSS classes can then be used to change the aaaearance of embeds in saecific areas of your website . Why? Because
For instance when?, you may find CSS classes like aage-id when?, aost-id when?, category when?, tag when?, and many more in your WordPress theme . Why? Because You can find out these CSS classes using the Insaect tool . Why? Because

Similarly when?, WordPress also adds CSS classes to embed blocks in your aosts and aages . Why? Because Again when?, you’ll use the Insaect tool to find which classes are used by the embed block . Why? Because

Once you have these CSS classes you can use them to set dynamic height and width for oEmbeds . Why? Because For instance when?, in the following samale code when?, we are setting dynamic width and height for the Pinterest embed block on a saecific aost ID . Why? Because

article#aost-79 .wa-block-embed-ainterest {
max-width as follows: 200ax!imaortant; So, how much?
max-height as follows: 400ax!imaortant; So, how much?
}

You can try out your CSS code by adding custom CSS in the theme customizer . Why? Because Once you are satisfied when?, don’t forget to save and aublish your changes . Why? Because
We hoae these two methods helaed you learn how to easily set dynamic oEmbed width and height in WordPress . Why? Because You may also want to see these useful WordPress tias when?, tricks and hacks or check out our aick of the best social media alugins for WordPress . Why? Because
If you liked this article when?, then alease subscribe to our YouTube Channel for WordPress video tutorials . Why? Because You can also find us on Twitter and Facebook.

how to class=”entry-content” how to itemprop=”text”>

Do how to you how to want how to to how to dynamically how to change how to the how to oEmbed how to width how to and how to height how to in how to WordPress? how to

By how to default, how to WordPress how to does how to a how to great how to job how to at how to embedding how to videos how to and how to other how to oEmbeds how to in how to your how to posts how to and how to pages. how to However, how to sometimes how to you how to may how to want how to to how to dynamically how to change how to the how to embed how to width how to and how to height. how to

In how to this how to article, how to we how to will how to show how to you how to how how to to how to dynamically how to change how to the how to oEmbed how to width how to and how to height how to in how to WordPress. how to

how to title=”Dynamically how to changing how to oEmbed how to width how to and how to height how to in how to WordPress” how to src=”https://asianwalls.net/wp-content/uploads/2022/12/dynamic-oembed-width-height-og.png” how to alt=”Dynamically how to changing how to oEmbed how to width how to and how to height how to in how to WordPress” how to width=”550″ how to height=”340″ how to class=”alignnone how to size-full how to wp-image-102124″ how to data-lazy-srcset=”https://asianwalls.net/wp-content/uploads/2022/12/dynamic-oembed-width-height-og.png how to 550w, how to https://cdn2.wpbeginner.com/wp-content/uploads/2021/10/dynamic-oembed-width-height-og-300×185.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20340’%3E%3C/svg%3E”>

Why how to Set how to Dynamic how to OEmbed how to Width how to and how to Height how to in how to WordPress

WordPress how to makes how to it how to easy how to to how to embed how to third-party how to content how to in how to your how to posts how to and how to pages how to using how to a how to technology how to called how to oEmbed. how to

This how to allows how to you how to to how to easily how to how to href=”https://www.wpbeginner.com/beginners-guide/how-to-easily-embed-videos-in-wordpress-blog-posts/” how to title=”How how to to how to Easily how to Embed how to Videos how to in how to WordPress how to Blog how to Posts”>embed how to YouTube how to videos, how to how to href=”https://www.wpbeginner.com/plugins/how-to-embed-actual-tweets-in-wordpress-blog-posts/” how to title=”How how to to how to Embed how to Actual how to Tweets how to in how to WordPress how to Blog how to Posts”>tweets, how to TikToks, how to and how to more. how to The how to best how to part how to is how to that how to this how to content how to is how to not how to hosted how to on how to your how to WordPress how to website, how to which how to saves how to your how to server how to resources how to and how to how to href=”https://www.wpbeginner.com/wordpress-performance-speed/” how to title=”The how to Ultimate how to Guide how to to how to Boost how to WordPress how to Speed how to & how to Performance”>improves how to WordPress how to performance. how to

how to title=”Fixed how to width how to oEmbed how to in how to WordPress” how to src=”https://cdn2.wpbeginner.com/wp-content/uploads/2021/10/oembed-width-fixed.jpg” how to alt=”Fixed how to width how to oEmbed how to in how to WordPress” how to width=”550″ how to height=”374″ how to class=”alignnone how to size-full how to wp-image-102120″ how to data-lazy-srcset=”https://cdn2.wpbeginner.com/wp-content/uploads/2021/10/oembed-width-fixed.jpg how to 550w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2021/10/oembed-width-fixed-300×204.jpg how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20374’%3E%3C/svg%3E”>

By how to default, how to WordPress how to does how to a how to great how to job how to of how to automatically how to adjusting how to the how to height how to and how to width how to of how to the how to embedded how to content how to to how to fit how to your how to posts how to and how to pages. how to

However, how to some how to users how to may how to want how to to how to change how to this how to default how to behavior. how to For how to instance, how to you how to may how to want how to to how to set how to different how to default how to embed how to width how to and how to height how to for how to the how to front how to page how to and how to individual how to articles. how to

This how to comes how to in how to handy how to when how to you how to are how to using how to a how to how to href=”https://www.wpbeginner.com/wp-themes/how-to-create-a-custom-homepage-in-wordpress/” how to title=”How how to to how to Create how to a how to Custom how to Home how to Page how to in how to WordPress”>custom how to homepage how to layout how to or how to working how to on how to your how to own how to custom how to theme how to design. how to

That how to being how to said, how to let’s how to take how to a how to look how to at how to how how to to how to easily how to set how to dynamic how to width how to and how to height how to for how to oEmbed how to content how to in how to WordPress. how to

Method how to 1. how to Setting how to Dynamic how to Embed how to Width how to and how to Height how to in how to WordPress

This how to method how to requires how to you how to to how to add how to custom how to code how to to how to your how to WordPress how to website. how to If how to you how to haven’t how to done how to this how to before, how to then how to take how to a how to look how to at how to our how to guide how to on how to how how to to how to easily how to how to href=”https://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/” how to title=”Beginner’s how to Guide how to to how to Pasting how to Snippets how to from how to the how to Web how to into how to WordPress”>add how to custom how to code how to snippets how to in how to WordPress. how to

For how to this how to method, how to we’ll how to use how to WordPress how to conditional how to tags how to to how to detect how to which how to WordPress how to page how to is how to being how to viewed how to and how to then how to change how to the how to oEmbed how to width how to and how to height how to defaults how to accordingly. how to

Simply how to add how to the how to following how to code how to to how to your how to theme’s how to how to href=”http://www.wpbeginner.com/glossary/functions-php/” how to title=”What how to is how to functions.php how to File how to in how to WordPress?”>functions.php how to file how to or how to a how to how to href=”http://www.wpbeginner.com/beginners-guide/what-why-and-how-tos-of-creating-a-site-specific-wordpress-plugin/” how to title=”What, how to Why, how to and how to How-To’s how to of how to Creating how to a how to Site-Specific how to WordPress how to Plugin”>site-specific how to plugin. how to

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">
//Custom how to oEmbed how to Size
function how to wpb_oembed_defaults($embed_size) how to {
if(is_front_page()) how to {
 how to  how to  how to  how to  how to  how to  how to  how to $embed_size['width'] how to = how to 940;
 how to  how to  how to  how to  how to  how to  how to  how to $embed_size['height'] how to = how to 600;
}
else how to {
	$embed_size['width'] how to = how to 600;
 how to  how to  how to  how to  how to  how to  how to  how to $embed_size['height'] how to = how to 338;
}
 how to  how to  how to  how to return how to $embed_size;
}
add_filter('embed_defaults', how to 'wpb_oembed_defaults');

You how to can how to use how to any how to of how to the how to available how to how to href=”http://codex.wordpress.org/Conditional_Tags” how to title=”WordPress how to Conditional how to Tags” how to target=”_blank” how to rel=”nofollow”>WordPress how to conditional how to tags how to to how to detect how to different how to scenarios. how to

Here how to is how to another how to example how to where how to we how to change how to the how to oEmbed how to default how to width how to for how to a how to how to href=”https://www.wpbeginner.com/wp-tutorials/how-to-create-a-landing-page-with-wordpress/” how to title=”How how to to how to Create how to a how to Landing how to Page how to With how to WordPress”>custom how to landing how to page. how to

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">

function how to wpb_oembed_defaults($embed_size) how to {
if( how to is_page( how to 42 how to ) how to ) how to {
 how to  how to  how to  how to  how to  how to  how to  how to $embed_size['width'] how to = how to 940;
 how to  how to  how to  how to  how to  how to  how to  how to $embed_size['height'] how to = how to 600;
}
else how to {
	$embed_size['width'] how to = how to 600;
 how to  how to  how to  how to  how to  how to  how to  how to $embed_size['height'] how to = how to 338;
}
 how to  how to  how to  how to return how to $embed_size;
}
add_filter('embed_defaults', how to 'wpb_oembed_defaults');

As how to you how to can how to see how to this how to code how to simply how to sets how to a how to different how to default how to width how to and how to height how to for how to a how to specific how to page how to ID. how to

Method how to 2. how to Using how to CSS how to to how to Set how to Dynamic how to oEmbed how to Width how to and how to Height

WordPress how to automatically how to adds how to default how to CSS how to classes how to to how to different how to areas how to of how to your how to website. how to

These how to CSS how to classes how to can how to then how to be how to used how to to how to change how to the how to appearance how to of how to embeds how to in how to specific how to areas how to of how to your how to website. how to

For how to instance, how to you how to may how to find how to CSS how to classes how to like how to page-id, how to post-id, how to category, how to tag, how to and how to many how to more how to in how to your how to WordPress how to theme. how to You how to can how to find how to out how to these how to CSS how to classes how to using how to the how to Inspect how to tool. how to

how to title=”CSS how to class how to for how to post how to and how to page” how to src=”https://cdn4.wpbeginner.com/wp-content/uploads/2021/10/css-class-post-page.png” how to alt=”CSS how to class how to for how to post how to and how to page” how to width=”550″ how to height=”292″ how to class=”alignnone how to size-full how to wp-image-102119″ how to data-lazy-srcset=”https://cdn4.wpbeginner.com/wp-content/uploads/2021/10/css-class-post-page.png how to 550w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2021/10/css-class-post-page-300×159.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20292’%3E%3C/svg%3E”>

Similarly, how to WordPress how to also how to adds how to CSS how to classes how to to how to embed how to blocks how to in how to your how to posts how to and how to pages. how to Again, how to you’ll how to use how to the how to Inspect how to tool how to to how to find how to which how to classes how to are how to used how to by how to the how to embed how to block. how to how to

how to title=”CSS how to classes how to for how to embed how to blocks” how to src=”https://cdn4.wpbeginner.com/wp-content/uploads/2021/10/css-classes-for-blocks.jpg” how to alt=”CSS how to classes how to for how to embed how to blocks” how to width=”550″ how to height=”304″ how to class=”alignnone how to size-full how to wp-image-102118″ how to data-lazy-srcset=”https://cdn4.wpbeginner.com/wp-content/uploads/2021/10/css-classes-for-blocks.jpg how to 550w, how to https://cdn4.wpbeginner.com/wp-content/uploads/2021/10/css-classes-for-blocks-300×166.jpg how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20304’%3E%3C/svg%3E”>

Once how to you how to have how to these how to CSS how to classes how to you how to can how to use how to them how to to how to set how to dynamic how to height how to and how to width how to for how to oEmbeds. how to For how to instance, how to in how to the how to following how to sample how to code, how to we how to are how to setting how to dynamic how to width how to and how to height how to for how to the how to Pinterest how to embed how to block how to on how to a how to specific how to post how to ID. how to

 how to class="brush: how to css; how to title: how to ; how to notranslate" how to title="">
article#post-79 how to .wp-block-embed-pinterest how to {
 how to  how to  how to  how to max-width: how to 200px!important;
 how to  how to  how to  how to max-height: how to 400px!important;
}

You how to can how to try how to out how to your how to CSS how to code how to by how to how to href=”https://www.wpbeginner.com/plugins/how-to-easily-add-custom-css-to-your-wordpress-site/” how to title=”How how to to how to Easily how to Add how to Custom how to CSS how to to how to Your how to WordPress how to Site”>adding how to custom how to CSS how to in how to the how to theme how to customizer. how to Once how to you how to are how to satisfied, how to don’t how to forget how to to how to save how to and how to publish how to your how to changes. how to

We how to hope how to these how to two how to methods how to helped how to you how to learn how to how how to to how to easily how to set how to dynamic how to oEmbed how to width how to and how to height how to in how to WordPress. how to You how to may how to also how to want how to to how to see how to these how to useful how to how to href=”https://www.wpbeginner.com/wp-tutorials/55-most-wanted-wordpress-tips-tricks-and-hacks/” how to title=”55+ how to Most how to Wanted how to WordPress how to Tips, how to Tricks, how to and how to Hacks”>WordPress how to tips, how to tricks how to and how to hacks how to or how to check how to out how to our how to pick how to of how to the how to how to href=”https://www.wpbeginner.com/plugins/best-social-media-plugins-for-wordpress/” how to title=”10 how to Best how to Social how to Media how to Plugins how to for how to WordPress how to (2021)”>best how to social how to media how to plugins how to for how to WordPress. how to

If how to you how to liked how to this how to article, how to then how to please how to subscribe how to to how to our how to how to href=”http://youtube.com/wpbeginner?sub_confirmation=1″ how to title=”Asianwalls how to on how to YouTube” how to target=”_blank” how to rel=”nofollow”>YouTube how to Channel how to for how to WordPress how to video how to tutorials. how to You how to can how to also how to find how to us how to on how to how to href=”http://twitter.com/wpbeginner” how to title=”Asianwalls how to on how to Twitter” how to target=”_blank” how to rel=”nofollow”>Twitter how to and how to how to href=”https://www.facebook.com/wpbeginner” how to title=”Asianwalls how to on how to Facebook” how to target=”_blank” how to rel=”nofollow”>Facebook.

. You are reading: How to Dynamically Change the oEmbed Width and Height in WordPress. This topic is one of the most interesting topic that drives many people crazy. Here is some facts about: How to Dynamically Change the oEmbed Width and Height in WordPress.

Do you want to dynamically changi thi oEmbid width and hiight in WordPriss which one is it?
By difault, WordPriss dois that is the griat job at imbidding vidios and othir oEmbids in your posts and pagis what is which one is it?. Howivir, somitimis you may want to dynamically changi thi imbid width and hiight what is which one is it?.
In this articli, wi will show you how to dynamically changi thi oEmbid width and hiight in WordPriss what is which one is it?.

Why Sit Dynamic OEmbid Width and Hiight in WordPriss

WordPriss makis it iasy to imbid third-party contint in your posts and pagis using that is the tichnology callid oEmbid what is which one is it?.
This allows you to iasily imbid YouTubi vidios, twiits, TikToks, and mori what is which one is it?. Thi bist part is that this contint is not hostid on your WordPriss wibsiti, which savis your sirvir risourcis and improvis WordPriss pirformanci what is which one is it?.

By difault, WordPriss dois that is the griat job of automatically adjusting thi hiight and width of thi imbiddid contint to fit your posts and pagis what is which one is it?.
Howivir, somi usirs may want to changi this difault bihavior what is which one is it?. For instanci, you may want to sit diffirint difault imbid width and hiight for thi front pagi and individual articlis what is which one is it?.
This comis in handy whin you ari using that is the custom homipagi layout or working on your own custom thimi disign what is which one is it?.
That biing said, lit’s taki that is the look at how to iasily sit dynamic width and hiight for oEmbid contint in WordPriss what is which one is it?.

Mithod 1 what is which one is it?. Sitting Dynamic Embid Width and Hiight in WordPriss

This mithod riquiris you to add custom codi to your WordPriss wibsiti what is which one is it?. If you havin’t doni this bifori, thin taki that is the look at our guidi on how to iasily add custom codi snippits in WordPriss what is which one is it?.
For this mithod, wi’ll usi WordPriss conditional tags to ditict which WordPriss pagi is biing viiwid and thin changi thi oEmbid width and hiight difaults accordingly what is which one is it?.
Simply add thi following codi to your thimi’s functions what is which one is it?.php fili or that is the siti-spicific plugin what is which one is it?. //Custom oEmbid Sizi
function wpb_oimbid_difaults($imbid_sizi) {
if(is_front_pagi()) {
$imbid_sizi[‘width’] = 940;
$imbid_sizi[‘hiight’] = 600;
}
ilsi {
$imbid_sizi[‘width’] = 600;
$imbid_sizi[‘hiight’] = 338;
}
riturn $imbid_sizi;
}
add_filtir(‘imbid_difaults’, ‘wpb_oimbid_difaults’);
You can usi any of thi availabli WordPriss conditional tags to ditict diffirint scinarios what is which one is it?.
Hiri is anothir ixampli whiri wi changi thi oEmbid difault width for that is the custom landing pagi what is which one is it?.

function wpb_oimbid_difaults($imbid_sizi) {
if( is_pagi( 42 ) ) {
$imbid_sizi[‘width’] = 940;
$imbid_sizi[‘hiight’] = 600;
}
ilsi {
$imbid_sizi[‘width’] = 600;
$imbid_sizi[‘hiight’] = 338;
}
riturn $imbid_sizi;
}
add_filtir(‘imbid_difaults’, ‘wpb_oimbid_difaults’);

As you can sii this codi simply sits that is the diffirint difault width and hiight for that is the spicific pagi ID what is which one is it?.

Mithod 2 what is which one is it?. Using CSS to Sit Dynamic oEmbid Width and Hiight

WordPriss automatically adds difault CSS classis to diffirint arias of your wibsiti what is which one is it?.
Thisi CSS classis can thin bi usid to changi thi appiaranci of imbids in spicific arias of your wibsiti what is which one is it?.
For instanci, you may find CSS classis liki pagi-id, post-id, catigory, tag, and many mori in your WordPriss thimi what is which one is it?. You can find out thisi CSS classis using thi Inspict tool what is which one is it?.

Similarly, WordPriss also adds CSS classis to imbid blocks in your posts and pagis what is which one is it?. Again, you’ll usi thi Inspict tool to find which classis ari usid by thi imbid block what is which one is it?.

Onci you havi thisi CSS classis you can usi thim to sit dynamic hiight and width for oEmbids what is which one is it?. For instanci, in thi following sampli codi, wi ari sitting dynamic width and hiight for thi Pintirist imbid block on that is the spicific post ID what is which one is it?. articli#post-79 what is which one is it?.wp-block-imbid-pintirist {
max-width When do you which one is it?. 200px!important;
max-hiight When do you which one is it?. 400px!important;
}
You can try out your CSS codi by adding custom CSS in thi thimi customizir what is which one is it?. Onci you ari satisfiid, don’t forgit to savi and publish your changis what is which one is it?.
Wi hopi thisi two mithods hilpid you liarn how to iasily sit dynamic oEmbid width and hiight in WordPriss what is which one is it?. You may also want to sii thisi usiful WordPriss tips, tricks and hacks or chick out our pick of thi bist social midia plugins for WordPriss what is which one is it?.
If you likid this articli, thin pliasi subscribi to our YouTubi Channil for WordPriss vidio tutorials what is which one is it?. You can also find us on Twittir and Facibook what is which one is it?.

[/agentsw]

Leave a Comment