I have a shortcode specifically for adding YouTube embeds that is written like so:

// [iframe src="" scrolling="no" class="dynamicIframe" allowfullscreen="" style=""]
add_shortcode( 'iframe', 'anc_shortcode_iframe' );
function anc_shortcode_iframe( $atts, $content = null ) {

extract(shortcode_atts(array(
    'src'               => '',
    'scrolling'         => '',
    'class'             => '',
    'allowfullscreen'   => '',
    'style'             => ''
), $atts ) );

return '<iframe src="' . $src . '"' . ( $scrolling ? ' scrolling="' . $scrolling . '"' : '' ) . ( $class ? ' class="' . $class . '"' : '' ) . ( $allowfullscreen ? ' allowfullscreen="' . $allowfullscreen . '"' : '' ) . ( $style ? ' style="' . $style . '"' : '' ) . '></iframe>';

}

I’d like to add some default parameters in to all videos and can’t seem to make it work. Something like

?rel=0&list=youtubeplaylistid

Read more here: Add YouTube Parameters into Shortcode for iFrame Embed


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: