Trying to append string in php involving dt_get_embed

I apologize in advance, I am a beginner. I don’t hand code I only edit code such as themes I am working with in Wordpress etc.

I try to solve my own problems but this one has me stumped.

The them I use has a built in shortcode that adds a frame around embed video. You paste your youtube URL and it uses dt_get_embed to change that to an embed code (which is what is causing me the problem).

The problem is that the videos are overlapping the content. Typically this is solved just by adding wmode=opaque to the end of the video URL.

But due to the shortcode and dt_get_embed handing it won’t accept parameters at the end of the URL.

So when I enter

http://www.youtube.com?watch=svidJfSp98U

The shortcode is returning

http://www.youtube.com/embed/svidJfSp98U?feature=oembed

I need it to return

http://www.youtube.com/embed/svidJfSp98U?feature=oembed&wmode=opaque

There are multiple files involved here, a core-functions.php file and a functions.php file for the shortcode.

I know these are the involved codes:

$attributes['media'] = esc_url($attributes['media']);
media = dt_get_embed($attributes['media']);
function dt_get_embed( $src, $width = null, $height = null ) {

	global $wp_embed;
	if ( empty( $wp_embed ) ) {
		return false;
	}
	$video_shotcode = sprintf( '[embed%s%s]%s[/embed]',

		!empty($width)?' width="'.intval($width).'"':'',
		!empty($height)?' height="'.intval($height).'"':'',
		$src 
	);
	$video_shotcode = $wp_embed->run_shortcode( $video_shotcode );

	return $video_shotcode;
}

I tried just adding the values into the above function but it never works out, I think it needs to be done in one of the first two places…or maybe it’s not doable do to how the dt_get_embed function works? I am unsure…been trying for days with no solution.

So far I have just had to manually input the proper code without using the shortcode, which is fine but a hassle.

in the function try this:
[php]$video_shotcode = $wp_embed->run_shortcode( $video_shotcode . ‘&wmode=opaque’);[/php]

let me know how you get on…

Red :wink:

Sponsor our Newsletter | Privacy Policy | Terms of Service