<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>El Rincón del Tio Nuke &#187; wordpress</title>
	<atom:link href="http://www.nukeador.com/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nukeador.com</link>
	<description>Donde todo es posible...</description>
	<lastBuildDate>Tue, 07 Sep 2010 19:21:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Vídeo ogv con HTML5 en WordPress</title>
		<link>http://www.nukeador.com/06/12/2009/video-ogv-con-html5-en-wordpress/</link>
		<comments>http://www.nukeador.com/06/12/2009/video-ogv-con-html5-en-wordpress/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 16:33:07 +0000</pubDate>
		<dc:creator>Nukeador</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Desarrollo Web]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.nukeador.com/?p=354</guid>
		<description><![CDATA[Recientemente he tenido que desarrollar para Mozilla Hispano un shortcode para WordPress que nos permitiese añadir a los artículos vídeos en formato libre Ogg Theora y que mostrará el vídeo en flash para aquellos navegadores que aún no admitan la etiqueta vídeo de HTML5. La sintaxis es la siguiente, sólo los atributos ogv y flash [...]]]></description>
			<content:encoded><![CDATA[<p>Recientemente he tenido que desarrollar para <a href="http://www.mozilla-hispano.org/">Mozilla Hispano</a> un <strong>shortcode para WordPress</strong> que nos permitiese añadir a los artículos <strong>vídeos en <a href="http://es.wikipedia.org/wiki/Theora">formato libre Ogg Theora</a></strong> y que mostrará el vídeo en flash para aquellos navegadores que aún no admitan <strong><a href="https://developer.mozilla.org/Es/Etiquetas_audio_y_video_en_Firefox">la etiqueta vídeo</a> de <a href="http://es.wikipedia.org/wiki/HTML_5">HTML5</a></strong>.</p>
<p>La sintaxis es la siguiente, sólo los atributos ogv y flash son obligatorios:</p>
<p><code>[open-video poster="/ruta/a/imagen.jpg" ogv="/ruta/al/archivo.ogv" mp4="/ruta/al/archivo.mp4" flash="/ruta/al/flash" width="500" height="350" ]</code></p>
<ul>
<li>poster → Imagen opcional para la vista previa.</li>
<li>ogv → Ruta al archivo ogv.</li>
<li>mp4 → Ruta al archivo opcional mp4 para navegadores que admiten video con este formato.</li>
<li>flash → Ruta al flash.</li>
<li>width → Ancho, de no definirse usará 640.</li>
<li>height → Alto, de no definirse usará 510.</li>
</ul>
<p>Para poderlo usar, debereís añadir al archivo <em>functions.php</em> de vuestro tema de WordPress lo siguiente:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> open_video<span style="color: #009900;">&#40;</span><span style="color: #000088;">$atts</span><span style="color: #339933;">,</span> <span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #990000;">extract</span><span style="color: #009900;">&#40;</span>shortcode_atts<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
                <span style="color: #0000ff;">&quot;width&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
                <span style="color: #0000ff;">&quot;height&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
                <span style="color: #0000ff;">&quot;poster&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
                <span style="color: #0000ff;">&quot;ogv&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
                <span style="color: #0000ff;">&quot;mp4&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
                <span style="color: #0000ff;">&quot;flash&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$atts</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">/* Tomamos tamaños o si no tomamos valores por defecto */</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$width</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$width</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;640&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$height</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$height</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;510&quot;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$salida</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;video&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$salida</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot; width=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$width</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> &quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$salida</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot; height=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$height</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> &quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$poster</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #000088;">$salida</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;poster=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$poster</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> &quot;</span><span style="color: #339933;">;</span> 
&nbsp;
		<span style="color: #000088;">$salida</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;controls&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$salida</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;source src=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$ogv</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> type=<span style="color: #000099; font-weight: bold;">\&quot;</span>video/ogg<span style="color: #000099; font-weight: bold;">\&quot;</span> /&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mp4</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #000088;">$salida</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;source src=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$mp4</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> type=<span style="color: #000099; font-weight: bold;">\&quot;</span>video/mp4<span style="color: #000099; font-weight: bold;">\&quot;</span> /&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$salida</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;object width=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$width</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> height=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$height</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> type=<span style="color: #000099; font-weight: bold;">\&quot;</span>application/x-shockwave-flash<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$salida</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot; data=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$flash</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$salida</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;param name=<span style="color: #000099; font-weight: bold;">\&quot;</span>movie<span style="color: #000099; font-weight: bold;">\&quot;</span> value=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$flash</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> /&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$salida</span> <span style="color: #339933;">.=</span>	<span style="color: #0000ff;">&quot;
&nbsp;
Necesitas el plugin de Flash para ver este vídeo
&nbsp;
&lt;/object&gt;&lt;/video&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$salida</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;
&nbsp;
&lt;small&gt;Descargar vídeo &lt;a href=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$ogv</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;en formato libre ogv&lt;/a&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mp4</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #000088;">$salida</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot; o &lt;a href=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$mp4</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;en formato mp4&lt;/a&gt;.&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$salida</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;/small&gt;
&nbsp;
&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$salida</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_shortcode<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;open-video&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;open_video&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.nukeador.com/06/12/2009/video-ogv-con-html5-en-wordpress/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.245 seconds -->
