'100%', 'height' => '480', 'scrolling' => 'no', 'class' => 'iframe-class', 'frameborder' => '0' ); // add defaults foreach ($defaults as $default => $value) { if (!array_key_exists($default, $atts)) { $atts[$default] = $value; } } // special case maps $src_cut = substr($atts["src"], 0, 35); if(strpos($src_cut, 'maps.google' )){ $atts["src"] .= '&output=embed'; } $html = ''; if( isset( $atts["same_height_as"] ) ){ $same_height_as = $atts["same_height_as"]; }else{ $same_height_as = ''; } if( $same_height_as != '' ){ $atts["same_height_as"] = ''; if( $same_height_as != 'content' ){ // we are setting the height of the iframe like as target element if( $same_height_as == 'document' || $same_height_as == 'window' ){ // remove quotes for window or document selectors $target_selector = $same_height_as; }else{ $target_selector = '"' . $same_height_as . '"'; } $html .= ' '; }else{ // set the actual height of the iframe (show all content of the iframe without scroll) $html .= ' '; } } $html .= "\n".''."\n"; $html .= ' $value) { if( $attr != 'same_height_as' ){ // remove some attributes if( $value != '' ) { // adding all attributes $html .= ' ' . $attr . '="' . $value . '"'; } else { // adding empty attributes $html .= ' ' . $attr; } } } $html .= '>'; return $html; } add_shortcode('iframe', 'iframe_embed_shortcode'); endif;