Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How do i change/filter the oembed max width settings (as set by ) admin -> media -> settings -> "Maximum embed size" before the oembed code gets executed. For example on the index pages i want it to be 540, but ona single page, i'd like to be 880?

share|improve this question

2 Answers

I believe the answer you want is here: http://forum.go41.de/topic/change-width-and-height-in-oembed-code-on-the-fly-wp-29

share|improve this answer
Using Regex is a possible way to go. I was hoping there was another way...but i guess this might be the best possible solution, because of the way wordpress handles oembeds – Wok May 3 '11 at 15:31

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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