su_shortcode_media

The shortcodes-ultimate su shortcode media function.

Published Date - February 15, 2021

Description

su_shortcode_media( $atts, $content );

Parameters

  1. $atts

  2. $content


Usage

The following example is for adding a hook callback.

if ( !function_exists( 'su_shortcode_media' ) ) {
    require_once ABSPATH . PLUGINDIR . 'shortcodes-ultimateshortcodes-ultimate/includes/shortcodes/media.php';
}

// The input(s). 
$atts = null;
$content = null;

// NOTICE! Understand what this does before running.
$result = su_shortcode_media( $atts, $content );
            

Defined

The function is defined in the following location(s).

shortcodes-ultimate/includes/shortcodes/media.php

function su_shortcode_media( $atts = null, $content = null ) {

	$atts = shortcode_atts( array(
			'url'        => '',
			'width'      => 600,
			'height'     => 400,
			'class'      => ''
		), $atts, 'media' );

	if ( strpos( $atts['url'], 'youtu' ) !== false ) {
		return su_shortcode_youtube( $atts, $content );
	}
	elseif ( strpos( $atts['url'], 'vimeo' ) !== false ) {
		return su_shortcode_vimeo( $atts, $content );
	}
	else {
		return '<img src="' . $atts['url'] . '" width="' . $atts['width'] . '" height="' . $atts['height'] . '" style="max-width:100%" />';
	}

}