Advertisement
viktormorales

Wordpress Shortcode: Compartir jsFiddle y PasteBin en tu blo

Mar 11th, 2012
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. <?php
  2.  /** 1. CREAR FUNCION EN EL ARCHIVO FUNCTIONS.PHP DE WORDPRESS */
  3.  
  4.  // Permite crear IFRAMES en las entradas de WordPress
  5.  function iframe_sc( $atts, $content = null )
  6.  {
  7.     extract( shortcode_atts( array(
  8.     'width' => ($width) ? $width : '100%',
  9.     'height' => ($height) ? $height : '400px',
  10.     'src' => $src
  11.     ), $atts ) );
  12.  
  13.     if ($width || $height || $latlon)
  14.         return "<iframe width='{$width}' height='{$height}' frameborder='0' marginheight='0' marginwidth='0' src='{$src}'></iframe>";
  15.  }
  16.  add_shortcode( 'iframe', 'iframe_sc' );
  17.  
  18.  /** 2. CREAR ENTRADA */
  19.  // En la entrada donde queramos compartir codigo escribimos: [iframe src="IFRAME SRC URL"]
  20.  // IFRAME SRC URL, es la URL arrojada por PasteBin o jsFiddle segun su opcion de embeber.
  21.  
  22.  // Este es un ejemplo utilizando PasteBin.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement