Using the following in your functions.php file should do the trick:
/**
* Configure default oEmbed video sizes
*/
function base_oembed_defaults($embed_size) {
if( is_single() ) {
$embed_size['width'] = 580;
$embed_size['height'] = 435;
}
return $embed_size;
}
add_filter('embed_defaults', 'base_oembed_defaults');
Add as many WordPress conditional statements as you like to match the desired aspect ratio for each template.
Related Posts:
- When oEmbed fails, display an alternative
- How to change default width parameter of embedded video in wordpress?
- Is it possible to remove height and width attributes from oEmbed video embeds
- how to escape wp_oembed_get for phpcs
- Fallback for oEmbed content
- WordPress refuses to show oembed URL
- Problems using WP’s oembed function + Instagram + AJAX
- How to increase image size returned from Flickr oEmbed in Twenty Twelve theme
- How to get the oEmbed type (audio, video, image etc.)?
- Disable automatic oEmbed of a youtube url within the content
- Add parameters vimeo videos using wordpress embeds
- oEmbed fails half of the times. Could I reload the request on fail?
- WordPress 5.3.x YouTube oEmbed is not working
- Getting results from wp_oembed_add_provider
- add oembed provider
- Register Embed Handler for Padlet.com
- How to Hide Ancestors/Threads in Embedded Tweets
- Use Auto Embed with get_post()
- How to modify the HTML formatting of an oEmbed link?
- OEMBED seems to have stopped working
- oEmbed not recognising Vimeo URLs
- Applying an oEmbed filter to a custom post type
- How to oEmbed MySite in WordPress
- Worrisome oembed hits
- What is the correct oembed provider base url for self-hosted wordpress sites
- Why is my oembed function modifying Twitter embed?
- Problem with oEmbed in some themes
- JSON in oembed not being internationalized (using QTranslateX)
- WordPress kills an iframe’s apostrophes
- Add title attribute to oEmbed iframe for accessibility
- What are available arguments for wp_oembed_get?
- How to disable oembed cache service?
- How to set parameters for a Twitter post using wp_oembed_get (remove rounded borders)?
- Use oEmbed for static html
- class-oembed Error
- Wrap iframes/embeds, but do it before oEmbed happens
- When formatting an oEmbed iframe, how (and where) does WordPress determine the height value?
- Avoid embedding YouTube videos and open them in a new window
- How to wrap oEmbed-embedded video in DIV tags inside the_content?
- WP Oembed not passing through the “autoplay=1” variable
- Get first video from the post (both embed and video shortcodes)
- Featured Image of Video from oembed
- How to Replace YouTube Videos with a “Click to Play” Thumbnail?
- Modify youtube video size on one page and show another size on different page
- Extract the first oembed url inserted on the content of a post
- Add wrapper to only youtube videos via embed_oembed_html filter function
- How to add new embed handler not supported by oembed
- How to use get_media_embedded_in_content function
- Enqueue script only if page has an oembed
- Displaying oEmbed errors?
- How to use oEmbeds on Post Content during AJAX requests
- Set first oembed in post to a global variable or function
- Any way to use a custom Parameter for vimeo embed without using an iframe?
- Remove frameborder attribute from iframes
- Making oEmbed work on the excerpt field
- How to add oEmbed support to my theme?
- oEmbed in wordpress multisite not working
- Run oembed separately outside the_content()
- wp_insert_post iframe missing
- Can I use wp_oembed_get to detect a valid embeddable link or is there a better way to do so?
- Embeding YouTube video via a template function throws iframe cross-domain policy error
- extra text in Vimeo Embedded videos
- Instagram URL is converted into oEmbed
- Video Embed with Captions in Turkish
- Add parameter (time) to oembed
- oEmbed does not work for comments
- oEmbed 404 errors when trying to use embed block
- Add field to dashboard to update embedded URL on homepage?
- Checkbox on a meta box using CMB2 Plugin
- How to disable YouTube (and any other oembed) embeding in the editor
- How can I grab the video id of youtube?
- How to change the oembed “type”?
- How can I remove the first video from a post and feature it?
- oembed_cache SPAM problem [closed]
- Div around YouTube video
- Combine embed_oembed_html and oembed_result
- oEmbed Video in Modal
- Add parameter to first post only
- Add class to oEmbed video from within post editor?
- Pull Youtube Link from 2nd WP_Editor
- Why does apply_filters behave different inside and outside a loop?
- Different size video display for category page (smaller) & detail page (larger)
- WordPress fails to embed video URL on specific theme
- How to add srcdoc attribute to YouTube oEmbed in Gutenberg oEmbed Block
- Facebook embeds fixing with functions.php
- Embed video from streamtape using direct link
- How to automatically search my entire site for any content embedded using oEmbed?
- Security when outputing wp_oembed_get code
- How do I keep my iframes responsive and scaled to fit their container?
- What is the correct way to obtain access to the WP_oEmbed object?
- oembed_dataparse filter not running at all for standard YouTube embed
- Remove wordpress embed share icon?
- Modify oembed code conditionally
- Load oEmbed iframe within ajax call
- oembed facebook link?
- Why doesn’t wp_oembed_get() for the video post format not work?
- WordPress Mediaelement – Youtube Videos Embed Options
- Displaying cf post formats with oembed
- After import, oEmbeds non-functional until manual republish
- oEmbed work on localhost but not on distant server