Arete
Arete

Reputation: 1004

Customize wordpress oEmbedd (soundcloud)

I am using Wordpress 4.3.1 and I noticed that it used oEmbed to automatically embed my tracks from soundcloud.

This is awesome! Except, I have no control over how the widget is displayed.

First of all I would like to display the "Classic Embed" without the artwork.

Secondly I want the widget to be wider.

How can I achieve this without editing the shortcode for each post in my wordpress page?

Upvotes: 0

Views: 211

Answers (1)

johnh10
johnh10

Reputation: 4185

You can add a filter to change the way the oEmbed code is displayed. Here is something to get you started:

// this function is called on all urls surrounded by the WordPress embed shortcode. // i.e.: [embed]https://soundcloud.com/gratefuldead/grateful-dead-box-of-rain[/embed] function my_embed_options( $code ) { // look for SoundCloud link: if( strpos( $code, 'soundcloud.com') !== false ) { $code = str_replace( 'show_artwork=true', 'show_artwork=false', $code ); } return $code; } add_filter( 'embed_oembed_html', 'my_embed_options' );

You can find full parameter list for the SoundCloud player here.

Upvotes: 2

Related Questions