WordPress.org

Ready to get started?Download WordPress

Forums

[Soundcloud oEmbed] oEmbed Auto-Resize doesn't work with Soundcloud (3 posts)

  1. tastingtheweb
    Member
    Posted 1 year ago #

    Dear all,

    I'm trying to figure out why my Soundcloud oEmbeds won't resize automatically, even though every other oEmbed (Youtube & Vimeo) works perfectly. I know, there are several workarounds to set a specific width to oEmbeds, like adding this to the function.php:

    //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’);

    Or adding these attributes to the soundcloud link:
    http://soundcloud.com/forss/flickermood?maxwidth=200&show_artwork=false

    They both get the job done quite well, BUT: Assigning a set width to oEmbeds ruins the responsiveness of my design, e.g. when viewed on a tablet or smartphone, a 960px width player (that fits perfectly in the desktop edition) is just way too big for a smaller screen.

    The weirdest of all is that setting a set width for oEmbeds in my theme's function.php has absolutely no effect on YouTube and Vimeo oEmbeds: they fill the content area perfectly and automatically appear in just the right size and with the right width.

    So, instead of setting a set width for oEmbeds, what other option do I have to make the oEmbedded Soundcloud player automatically resize and stay responsive?

    My website: tastingtheweb.com

    Thanks a lot for your help!

    Kind regards,
    tastingtheweb

  2. tastingtheweb
    Member
    Posted 1 year ago #

    Any suggestions?

  3. tastingtheweb
    Member
    Posted 1 year ago #

    Anyone?

Topic Closed

This topic has been closed to new replies.

About this Topic