Simple iframe shortcode for wordpress


/ Published in: PHP
Save to your folder(s)

this is a simple script to take iframe parameters and build an iframe via a shortcode


Copy this code and paste it in your HTML
  1. add_shortcode('iframe', 'iframe');
  2. function iframe($atts) {
  3. extract(shortcode_atts(array(
  4. 'src' => "",
  5. 'width' => "800",
  6. 'height' => "600"
  7. ), $atts));
  8.  
  9. $iframe = '<iframe src="'.$src.'" width="'.$width.'" height="'.$height.'" scrolling="no" allowtransparency="yes" frameborder="0" ></iframe>';
  10.  
  11. return $iframe;
  12. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.