<?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>Eliseos.net &#187; hack</title> <atom:link href="http://eliseos.net/tag/hack/feed/" rel="self" type="application/rss+xml" /><link>http://eliseos.net</link> <description>Wordpress, Diseño, jQuery and Coffee</description> <lastBuildDate>Fri, 03 Sep 2010 00:07:36 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" /> <item><title>Muestra tus entradas fuera de la instalacion de WordPress</title><link>http://eliseos.net/muestra-entradas-fuera-instalacion-wordpress/</link> <comments>http://eliseos.net/muestra-entradas-fuera-instalacion-wordpress/#comments</comments> <pubDate>Thu, 26 Aug 2010 03:09:02 +0000</pubDate> <dc:creator>Alexis</dc:creator> <category><![CDATA[Wordpress]]></category> <category><![CDATA[cms]]></category> <category><![CDATA[hack]]></category><guid
isPermaLink="false">http://eliseos.net/?p=3183</guid> <description><![CDATA[Hay veces que necesitamos mostrar data de una instalación de Wordpress pero nos encontramos fuera de Wordpress. Por ejemplo en nuestro index tenemos un archivo HMTL con la presentación de nuestra empresa]]></description> <content:encoded><![CDATA[<p
style="text-align: left;">Hay veces que necesitamos <strong>mostrar data de una instalación</strong> de WordPress pero nos encontramos <strong>fuera de WordPress</strong>. Por ejemplo en nuestro index tenemos un archivo HMTL con la presentación de nuestra empresa, y en la carpeta Blog tenemos la instalación de WordPress. Y lo que necesitamos mostrar es en nuestro index los últimos post que escribimos en el Blog.</p><p
style="text-align: center;"><img
src="http://eliseos.net/wp-content/uploads/2010/08/Mostra-tus-entradas-fuera-de-la-instalacion-de-WordPress.jpg" alt="Mostra tus entradas fuera de la instalacion de WordPress Muestra tus entradas fuera de la instalacion de WordPress" title="Mostra entradas fuera instalacion WordPress" width="600" height="250" class="alignnone size-full wp-image-3184" /></p><p
style="text-align: left;">Una salida poco elegante seria <strong>embeber el feed</strong> de nuestro Blog y luego hacer el pasaje, pero los chicos Cool hacemos otra cosa, lo hacemos mas simple, usamos: <strong>wp-load.php</strong> que nos permite acceder a la info de WordPress sin sobresaltos.</p><p
style="text-align: left;">Supongamos que en nuestro index queremos mostrar las <strong>ultimas 6 entradas</strong> que se escribieron en el Blog, solo necesitamos incluir estas lineas donde necesitamos mostrar las entradas:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
  <span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'../blog/wp-load.php'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//ruta a wp-load.php</span>
  <span style="color: #666666; font-style: italic;">// Asegurate que la ruta sea la correcta</span>
&nbsp;
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;h3&gt;Últimos post desde el Blog&lt;/h3&gt;'</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;ul&gt;'</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$number</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">6</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// cantidad de entradas a mostrar</span>
  <span style="color: #000088;">$recent_posts</span> <span style="color: #339933;">=</span> wp_get_recent_posts<span style="color: #009900;">&#40;</span><span style="color: #000088;">$number</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// obtener los post por ID y ordenar de manera descendente</span>
  <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$recent_posts</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt;&lt;a href=&quot;'</span><span style="color: #339933;">.</span>get_permalink<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;ID&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;post_title&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/a&gt; &lt;p&gt; '</span><span style="color: #339933;">.</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;post_excerpt&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/p&gt; &lt;/li&gt;'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/ul&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div><p
style="text-align: left;">Como lo podes ver estoy incluyendo solo la intro de cada post, es decir el <em><code>excerpt</code></em>, pero si lo necesitas podes cargar todo el contenido del post, solo debes reemplazar <em><code>post_excerpt</code></em> por <em><code>post_content</code></em>.</p><p
style="text-align: left;">Este método responde a todas las variables localizadas dentro de la funcion <a
href="http://codex.wordpress.org/Function_Reference/get_post">get post()</a> por lo que podemos mostrar <strong>casi cualquier data</strong> que necesitemos, por ejemplo: la fecha, los tags, cantidad de comentarios, etc.</p><p
style="text-align: left;">Código ligeramente modificado de <a
href="http://snipplr.com/view/39526/pulling-posts-from-outside-wordpress-in-the-right-way/">Snipplr</a></p> ]]></content:encoded> <wfw:commentRss>http://eliseos.net/muestra-entradas-fuera-instalacion-wordpress/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Obtener el Width y Height de un Thumbnail en WordPress</title><link>http://eliseos.net/obtener-width-height-thumbnail-wordpress/</link> <comments>http://eliseos.net/obtener-width-height-thumbnail-wordpress/#comments</comments> <pubDate>Thu, 12 Aug 2010 22:53:30 +0000</pubDate> <dc:creator>Alexis</dc:creator> <category><![CDATA[Wordpress]]></category> <category><![CDATA[hack]]></category> <category><![CDATA[imagenes]]></category><guid
isPermaLink="false">http://eliseos.net/?p=3138</guid> <description><![CDATA[Probablemente en cierto momento de tu vida al trabajar con Wordpress vas a necesitar obtener el alto y ancho de las imágenes que subís mediante la biblioteca de medios]]></description> <content:encoded><![CDATA[<p
style="text-align: left;">Probablemente en cierto momento de tu vida al <strong>trabajar con WordPress</strong> vas a necesitar obtener el <strong>alto y ancho</strong> de las imágenes que subís mediante la <strong>biblioteca</strong> de medios. Desde la salida de WordPress 2.9 es muy simple <strong>asociar una imagen</strong> a una entrada, pero no es posible obtener el ancho y alto de la imagen de manera convencional.</p><p><span
id="more-3138"></span></p><p
style="text-align: left;">Para solucionar este problema existe una función poco conocida que nos permitirá realizar el trabajo:<a
href="http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src"> wp_get_attachment_image_src()</a> Esta función nos devolverá los <strong>valores asociados</strong> a una Thumbnail en un post.</p><p
style="text-align: left;">Donde lo necesitemos podemos incluir dentro del Loop:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$imgdata</span> <span style="color: #339933;">=</span> wp_get_attachment_image_src<span style="color: #009900;">&#40;</span> get_post_thumbnail_id<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'thumbnail'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$imgurl</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$imgdata</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// url del thumbnail</span>
<span style="color: #000088;">$imgwidth</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$imgdata</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// width del thumbnail</span>
<span style="color: #000088;">$imgheight</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$imgdata</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// height del thumbnail</span></pre></div></div><p
style="text-align: left;">Como podes ver estamos devolviendo los valores para el valor thumbnail, pero si lo necesitamos podes también usar <strong>medium</strong>, <strong>large</strong> o <strong>full</strong>.</p><p
style="text-align: left;">Un ejemplo de su aplicación puede ser:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$imgdata</span> <span style="color: #339933;">=</span> wp_get_attachment_image_src<span style="color: #009900;">&#40;</span> get_post_thumbnail_id<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'thumbnail'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$imgurl</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$imgdata</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> 
<span style="color: #000088;">$imgwidth</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$imgdata</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$imgheight</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$imgdata</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;img src=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$imgurl</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$imgwidth</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$imgheight</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; alt=&quot;&quot; /&gt;'</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div><p
style="text-align: left;">De esta manera obtenemos el link a la imagen asociada al Post junto con su height y widht.</p><p
style="text-align: left;">Este método no es algo que se utilice muy a menudo, pero siempre es bueno tener estas cosas presentes para tener más opciones y entender como trabaja el Core de WordPress.</p> ]]></content:encoded> <wfw:commentRss>http://eliseos.net/obtener-width-height-thumbnail-wordpress/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Simple y facil: Contar la cantidad de palabras en un post</title><link>http://eliseos.net/simple-facil-contar-cantidad-palabras-post/</link> <comments>http://eliseos.net/simple-facil-contar-cantidad-palabras-post/#comments</comments> <pubDate>Fri, 23 Jul 2010 22:30:09 +0000</pubDate> <dc:creator>Alexis</dc:creator> <category><![CDATA[Wordpress]]></category> <category><![CDATA[hack]]></category><guid
isPermaLink="false">http://eliseos.net/?p=3095</guid> <description><![CDATA[Siempre que reviso el repositorio de Wordpress me encuentro con innumerables plugins innecesarios, ya a esta altura deben saber que no soy muy amante de sobrecargar una instalación de Wordpress con plugins]]></description> <content:encoded><![CDATA[<p
style="text-align: left;">Siempre que reviso el repositorio de WordPress me encuentro con innumerables<strong> plugins innecesarios</strong>, ya a esta altura deben saber que no soy muy amante de sobrecargar una instalación de WordPress con plugins que pueden ser reemplazados por unas <strong>simple lineas de código</strong> usando el <strong>Core</strong> de WordPress.</p><p><span
id="more-3095"></span></p><p
style="text-align: left;">A que viene todo esto? He visto que hay varios plugins para mostrar cuantas palabras contiene una entrada. Algo que lo podemos lograr en dos segundos sin utilizar ningún tipo de plugin.</p><p
style="text-align: left;">Tenemos dos opciones para trabajar.</p><h2>Primera opción</h2><p
style="text-align: left;">Como bien lo mencionan en <a
href="http://digwp.com/2010/04/wordpress-custom-functions-php-template-part-2/">DigWP</a>, en tu archivo <em><code>functions.php</code></em> crearemos una nueva función:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> contar_palabras<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #990000;">str_word_count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p
style="text-align: left;">Sola resta realizar el llamado correspondiente donde queramos que se muestren la cantidad de palabras utilizadas en un post, por ejemplo:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">Esta entrada cuenta con <span style="color: #000000; font-weight: bold;">&lt;?php</span> contar_palabras<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> palabras.</pre></div></div><p
style="text-align: left;">La principal <strong>ventaja</strong> de este método es que no estamos limitados solo a contar palabras dentro de una entrada, si no que también podemos hacerlo con cualquier otro ítem, por ejemplo el titulo:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">Este titulo cuenta con <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">str_word_count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_title</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> palabras.</pre></div></div><h2>Segunda opción</h2><p
style="text-align: left;">Si no estamos de humor para tocar el archivo <em><code>functions.php</code></em>, podemos evitarlo y utilizar esta linea:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">Esta entrada cuenta con <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">str_word_count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> palabras.</pre></div></div><p
style="text-align: left;">Solo debemos asegurarnos que estamos dentro del <strong>Loop</strong> y tendremos la cantidad de palabras utilizadas.</p> ]]></content:encoded> <wfw:commentRss>http://eliseos.net/simple-facil-contar-cantidad-palabras-post/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Incrementar el largo del selector de categorias en WordPress</title><link>http://eliseos.net/incrementar-largo-height-selector-categorias-wordpress/</link> <comments>http://eliseos.net/incrementar-largo-height-selector-categorias-wordpress/#comments</comments> <pubDate>Thu, 22 Jul 2010 22:49:37 +0000</pubDate> <dc:creator>Alexis</dc:creator> <category><![CDATA[Wordpress]]></category> <category><![CDATA[hack]]></category><guid
isPermaLink="false">http://eliseos.net/?p=3091</guid> <description><![CDATA[Si sos un tanto "quisquilloso" o contás con una inmensa cantidad de categorías en tu sitio, quizás encuentres un tanto molesto tener que hacer scroll cada vez que escribís una nueva entrada para seleccionar la categoría que queremos]]></description> <content:encoded><![CDATA[<p
style="text-align: left;">Si sos un tanto &#8220;quisquilloso&#8221; o contás con una inmensa <strong>cantidad de categorías</strong> en tu sitio, quizás encuentres un tanto molesto tener que hacer scroll cada vez que escribís una nueva entrada para <strong>seleccionar la categoría</strong> que necesitas. Lamentablemente el box donde se encuentran las categorías no se comporta como un <strong>Meta box </strong>y no podemos controlar el largo o el ancho.</p><p
style="text-align: left;">Por suerte desde <a
href="http://wpcanyon.com/tipsandtricks/increasing-the-categories-selection-height-in-wordpress-admin/" title="Increasing The Categories Selection Height In WordPress Admin">WpCanyon</a> nos plantean una solución sencilla: Hacer que el largo del selector de categorías se comporte acorde a nuestras necesidades.</p><p
style="text-align: left;">Una primera opción es aplicar un filtro y definir el <em><code>height</code></em> que necesitamos, para este en tu archivo <em><code>functions.php</code></em> crea este nuevo filtro:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'admin_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'categories_list_height_css'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> categories_list_height_css<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span><span style="color: #0000ff;">'
	&lt;style type=&quot;text/css&quot;&gt;
		#category-all.tabs-panel{ height:500px; }
	&lt;/style&gt;
	'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p
style="text-align: left;">Lo importante es que definas un <em><code>height</code></em> que se adapte a tus necesidades. Generalmente <strong>500px</strong> son más que suficientes, pero se llegaras a tener muchas categorías, tal vez debas ajustar este valor.</p><p
style="text-align: left;">Otra opción es utilizar <strong>jQuery</strong> (recomendable) y hacer el que <em><code>height</code></em> se ajuste automáticamente. De nuevo crearemos un filtro con el siguiente contenido:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'admin_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'categories_list_height_jquery'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> categories_list_height_jquery<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span><span style="color: #0000ff;">'
	&lt;script type=&quot;text/javascript&quot;&gt;
		jQuery(function($){
			$(&quot;#category-all.tabs-panel&quot;).height($(&quot;#categorychecklist&quot;).height());
		});
	&lt;/script&gt;
	'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p
style="text-align: left;">Cualquiera de las dos alternativas es más que válida, solo debes elegir la que te haga sentir más cómodo.</p> ]]></content:encoded> <wfw:commentRss>http://eliseos.net/incrementar-largo-height-selector-categorias-wordpress/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Usar CSS3 en Internet Explorer 6-8</title><link>http://eliseos.net/usar-css3-internet-explorer-6-8/</link> <comments>http://eliseos.net/usar-css3-internet-explorer-6-8/#comments</comments> <pubDate>Mon, 12 Jul 2010 20:29:24 +0000</pubDate> <dc:creator>Alexis</dc:creator> <category><![CDATA[CSS]]></category> <category><![CDATA[CSS3]]></category> <category><![CDATA[hack]]></category><guid
isPermaLink="false">http://eliseos.net/?p=3065</guid> <description><![CDATA[Hace unos meses atrás había hablado aquí de como hacer que Internet Explorer se comporte como un navegador moderno al hacer que abrace algunas de las propiedades que CSS3 tiene para ofrecer]]></description> <content:encoded><![CDATA[<p
style="text-align: left;">Hace unos meses atrás <a
href="http://eliseos.net/?p=2836">había hablado</a> aquí de como hacer que <strong>Internet Explorer</strong> se comporte como un navegador moderno al hacer que abrace algunas de las propiedades que <strong>CSS3</strong> tiene para ofrecer.</p><p
style="text-align: center;"><img
class="alignnone size-large wp-image-3066" title="PIE CSS3" src="http://eliseos.net/wp-content/uploads/2010/07/PIE-CSS3-600x361.jpg" alt="PIE CSS3 600x361 Usar CSS3 en Internet Explorer 6 8" width="600" height="361" /></p><p
style="text-align: left;">El día de hoy, ha salido otra alternativa: <a
title="PIE CSS3" href="http://css3pie.com/">CSS3 PIE</a> que como el método anterior, también trabaja por medio de un archivo <strong>htc</strong> para poder usar las propiedades de <strong>CSS3</strong> que necesitamos.</p><p
style="text-align: left;">Estas propiedades que se pueden utilizar son: border-radius, box-shadow, border-image, -pie-background (multiple background images), multiple background images (integacion con javascript), rgba color values y gradients.</p><p
style="text-align: left;">Como se puede apreciar, no están todas la propiedades que un quisiera, pero si se encuentran las quizás, mas usadas; por lo que podremos brindarles a los usuarios de IE un experiencia mas agradable a la hora de visitar nuestro sitio.</p><p
style="text-align: left;">En cuanto a su uso o aplicación, es de lo mas sencillo, solo debemos hacer referencia al archivo <strong>htc</strong> en un regla y listo. Por ejemplo:</p><div
class="wp_syntax"><div
class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#unelemento</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#999</span><span style="color: #00AA00;">;</span>
    -webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
    -moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
    border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
    behavior<span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">ruta/a/PIE.htc</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div><p
style="text-align: left;"> Por ultimo no te olvides de revisar la documentación, donde encontraras ejemplo prácticos junto con todo lo necesario para hacer correr CSS3 en Internet Explorer.</p> ]]></content:encoded> <wfw:commentRss>http://eliseos.net/usar-css3-internet-explorer-6-8/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Excluir categorias del resultado de busqueda en WordPress</title><link>http://eliseos.net/excluir-categorias-resultado-busqueda-wordpress/</link> <comments>http://eliseos.net/excluir-categorias-resultado-busqueda-wordpress/#comments</comments> <pubDate>Tue, 15 Jun 2010 02:08:18 +0000</pubDate> <dc:creator>Alexis</dc:creator> <category><![CDATA[Wordpress]]></category> <category><![CDATA[buscador]]></category> <category><![CDATA[hack]]></category><guid
isPermaLink="false">http://eliseos.net/?p=3012</guid> <description><![CDATA[Si por alguna razón necesitas excluir una categoría en particular de los resultados de búsqueda de tu sitio este Snippet, puede que te sea de utilidad]]></description> <content:encoded><![CDATA[<p
style="text-align: left;">Si por alguna razón necesitas <strong>excluir</strong> una categoría en particular de los resultados de búsqueda de tu sitio este <strong>Snippet</strong>, puede que te sea de utilidad.</p><p
style="text-align: left;">Funciona de manera muy simple y consistente, solo se debe asignar el nombre de la categoría a excluir y el Snippet hará el trabajo.</p><h2>En tu archivo functions.php inserta:</h2><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> SearchFilter<span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">is_search</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cat'</span><span style="color: #339933;">,-</span>get_cat_ID<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'CategoryName'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$query</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'pre_get_posts'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'SearchFilter'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p
style="text-align: left;">Solo necesitas reemplazar <em><code>CategoryName</code></em> por el nombre de la categoría que deseas excluir de los resultados.</p><p
style="text-align: left;">Simple, pero efectivo</p> ]]></content:encoded> <wfw:commentRss>http://eliseos.net/excluir-categorias-resultado-busqueda-wordpress/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Modificar atributos al insertar imagenes en WordPress</title><link>http://eliseos.net/modificar-atributos-insertar-imagenes-wordpress/</link> <comments>http://eliseos.net/modificar-atributos-insertar-imagenes-wordpress/#comments</comments> <pubDate>Wed, 09 Jun 2010 21:05:16 +0000</pubDate> <dc:creator>Alexis</dc:creator> <category><![CDATA[Wordpress]]></category> <category><![CDATA[hack]]></category><guid
isPermaLink="false">http://eliseos.net/?p=3000</guid> <description><![CDATA[Como todos los sabemos cada vez que usamos el gestor de medios de Wordpress para añadir un imagen, este asigna una serie de atributos al tag img, que no siempre puede ser el que realmente necesitemos o no se adapte a nuestras necesidades]]></description> <content:encoded><![CDATA[<p
style="text-align: left;">Como todos los sabemos cada vez que usamos el <strong>gestor de medios</strong> de WordPress para añadir un imagen, este asigna una serie de atributos al tag <em>img</em>, que no siempre puede ser el que realmente necesitemos o no se adapte a nuestras necesidades.</p><p><span
id="more-3000"></span></p><p
style="text-align: left;">Como bien nos comentan en <a
href="http://www.webtechwise.com/wordpress-filter-examples-changing-attributes-when-adding-images-to-posts/">Webtechwise</a> una forma de adaptar los atributos de <em><code>img</code></em> a nuestras necesidades seria modificar el <strong>Core de WordPress</strong>, algo nunca recomendado. Por eso una mejor idea es la de crear una función especifica para este tema.</p><p
style="text-align: left;">WordPress cuenta con la funcion <em><code>get_image_tag</code></em> que es la encargada de asignar los valores para el tag <em><code>img</code></em> cada vez que se inserta una imagen en el post</p><p
style="text-align: left;">Cuando insertamos una imagen dentro de un post este es el <strong>HTML</strong> que obtenemos</p><div
class="wp_syntax"><div
class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://misitio.com/wp-content/uploads/2010/06/imagen.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;rss-icon&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;30&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;43&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;aligncenter size-full wp-image-1525&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div><p
style="text-align: left;">Con una serie de filtros podemos re-escirbir desde la base la función <em><code>get_image_tag</code></em> para poder obtener el resultado que necesitemos.</p><p
style="text-align: left;">Por ejemplo, podemos crear una función que siempre asigne el valor <em><code>post_image</code></em> como <strong>class</strong> a todas nuestras imágenes. En nuestro archivo functions.php añadiremos:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> my_image_tag_class<span style="color: #009900;">&#40;</span><span style="color: #000088;">$class</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'post_image'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$class</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'get_image_tag_class'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'my_image_tag_class'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p
style="text-align: left;">No solo nos podemos limitar a signar una <strong>class</strong> especifica, sino que como lo mencione más arriba podemos reescribir la función entera. Ya que si observamos la <em><code>funcion get_image_tag</code></em> (localizada en wp-includes/media.php) nos encontramos con varios <strong>hooks</strong> para re-escribir la función:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> get_image_tag<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$alt</span><span style="color: #339933;">,</span> <span style="color: #000088;">$title</span><span style="color: #339933;">,</span> <span style="color: #000088;">$align</span><span style="color: #339933;">,</span> <span style="color: #000088;">$size</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'medium'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">list</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$img_src</span><span style="color: #339933;">,</span> <span style="color: #000088;">$width</span><span style="color: #339933;">,</span> <span style="color: #000088;">$height</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> image_downsize<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$size</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$hwstring</span> <span style="color: #339933;">=</span> image_hwstring<span style="color: #009900;">&#40;</span><span style="color: #000088;">$width</span><span style="color: #339933;">,</span> <span style="color: #000088;">$height</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'align'</span> <span style="color: #339933;">.</span> esc_attr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$align</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">' size-'</span> <span style="color: #339933;">.</span> esc_attr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$size</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' wp-image-'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$id</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> apply_filters<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'get_image_tag_class'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$class</span><span style="color: #339933;">,</span> <span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$align</span><span style="color: #339933;">,</span> <span style="color: #000088;">$size</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$html</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;img src=&quot;'</span> <span style="color: #339933;">.</span> esc_attr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$img_src</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; alt=&quot;'</span> <span style="color: #339933;">.</span> esc_attr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$alt</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; title=&quot;'</span> <span style="color: #339933;">.</span> esc_attr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; '</span><span style="color: #339933;">.</span><span style="color: #000088;">$hwstring</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'class=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$class</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$html</span> <span style="color: #339933;">=</span> apply_filters<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'get_image_tag'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$html</span><span style="color: #339933;">,</span> <span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$alt</span><span style="color: #339933;">,</span> <span style="color: #000088;">$title</span><span style="color: #339933;">,</span> <span style="color: #000088;">$align</span><span style="color: #339933;">,</span> <span style="color: #000088;">$size</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$html</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p
style="text-align: left;">Otro ejemplo de este método, puede ser para mejor el <strong>SEO</strong> en nuestras entradas asignar el titulo de la entrada dentro de nuestro atributo <em><code>alt</code></em>. Para eso, otra vez dentro de function.php insertaremos esta nueva función:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> my_image_tag<span style="color: #009900;">&#40;</span><span style="color: #000088;">$html</span><span style="color: #339933;">,</span> <span style="color: #000088;">$id</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$alt</span><span style="color: #339933;">,</span> <span style="color: #000088;">$title</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$html</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'alt=&quot;&quot;'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'alt=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$title</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">,</span><span style="color: #000088;">$html</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$html</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'get_image_tag'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'my_image_tag'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p
style="text-align: left;">Ahora todas las imágenes de nuestra entrada estarán <strong>SEO optimizadas</strong>, sin la necesidad de un plugin. Los últimos dos parámetros de la función corresponden a la prioridad del filtro (10 por defecto) y la cantidad de argumentos que acepta la función respectivamente</p> ]]></content:encoded> <wfw:commentRss>http://eliseos.net/modificar-atributos-insertar-imagenes-wordpress/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Aplicar un formato diferente para cada entrada en WordPress</title><link>http://eliseos.net/aplicar-formato-diferente-entrada-wordpress/</link> <comments>http://eliseos.net/aplicar-formato-diferente-entrada-wordpress/#comments</comments> <pubDate>Tue, 18 May 2010 22:57:59 +0000</pubDate> <dc:creator>Alexis</dc:creator> <category><![CDATA[Wordpress]]></category> <category><![CDATA[hack]]></category> <category><![CDATA[php]]></category><guid
isPermaLink="false">http://eliseos.net/?p=2987</guid> <description><![CDATA[Como todos sabemos en Wordpress es posible definir un template para cada pagina muy fácilmente, incluso para las categorías. Pero que sucede si queremos asignar una template para una entrada en particular]]></description> <content:encoded><![CDATA[<p
style="text-align: left;">Como todos sabemos en WordPress es posible <strong>definir un template</strong> para cada pagina muy fácilmente, incluso para las categorías. Pero que sucede si queremos asignar una <strong>template</strong> para una <strong>entrada en particular</strong>? Bueno, muchas opciones la verdad que no tenemos&#8230; por suerte Nathan Rice nos acerca dos soluciones.</p><h2>Mediante un filtro</h2><p
style="text-align: left;">Una primera aproximación consiste en <a
href="http://www.nathanrice.net/blog/wordpress-single-post-templates/">crear un filtro</a> donde indicaremos que si estamos en un post (<em><code>single.php</code></em>) se busque un template creado específicamente para esa entrada. Esto se logra ya que WordPress asigna un <strong>ID</strong> unico a cada post. Al usar este método, si tenemos un post con un<strong> ID=33</strong>; la función busca el template <em><code>single-33.php</code></em> y utiliza este en lugar de <em><code>single.php</code></em>. De no encontrarse ese template se vuelve a utilizar <em><code>single.php</code></em>.</p><h3>Dentro del archivo functions.php insertaremos:</h3><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'single_template'</span><span style="color: #339933;">,</span> <span style="color: #990000;">create_function</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'$t'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'foreach( (array) get_the_category() as $cat ) { if ( file_exists(TEMPLATEPATH . &quot;/single-{$cat-&gt;term_id}.php&quot;) ) return TEMPLATEPATH . &quot;/single-{$cat-&gt;term_id}.php&quot;; } return $t;'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p
style="text-align: left;">Para utilizar este método, es recomendable duplicar nuestro <em><code>single.php</code></em>, realizar los cambios necesarios y guardarlo con ID al que haremos referencia, por ejemplo <em><code>single-33.php</code></em></p><h2>Mediante un plugin</h2><p
style="text-align: left;">Otra opción con la que contamos es poder un plugin creado por el <a
href="http://www.nathanrice.net/plugins/single-post-template/">mismo autor</a>, donde basicamente el proceso es el mismo, pero a su vez nos permite utilizar el menú <strong>drop-down</strong> que encontramos cuando asignamos un template a un pagina.</p><p
style="text-align: left;">Para utilizar este plugin debemos crear un nuevo archivo dentro de la carpeta de nuestro Theme con el siguiente encabezado:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/*
Single Post Template: [Un titulo descriptivo para nuestro template]
Description: Opcional, pero un buena descripción siempre nos sirve de guía
*/</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div><p
style="text-align: left;">Luego del encabezado le sigue la estructura normal del archivo <em><code>single.php</code></em> con los cambios realizados, por supuesto. Cuando necesitemos resaltar una entrada en particular solo restara elegir el template adecuado desde el editor de entradas y nuestra entrada sera diferente a las demás.</p><p
style="text-align: left;">Esta es una tendencia que se esta usando mucho en esta época, ya que nos permite distinguirnos del resto de manera muy efectiva.</p> ]]></content:encoded> <wfw:commentRss>http://eliseos.net/aplicar-formato-diferente-entrada-wordpress/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Toma control del titulo de cada post</title><link>http://eliseos.net/toma-control-titulo-cada-post/</link> <comments>http://eliseos.net/toma-control-titulo-cada-post/#comments</comments> <pubDate>Mon, 26 Apr 2010 20:57:58 +0000</pubDate> <dc:creator>Alexis</dc:creator> <category><![CDATA[Wordpress]]></category> <category><![CDATA[hack]]></category><guid
isPermaLink="false">http://eliseos.net/?p=2905</guid> <description><![CDATA[Como lo sabrás la etiqueta &#60;title&#62; es muy importante por diversas razones, ya sea SEO, para informar en sección del sitio nos encontramos. Generalmente (aunque no siempre sucede)]]></description> <content:encoded><![CDATA[<p
style="text-align: left;">Como lo sabrás la <strong>etiqueta</strong> <em><code>&lt;title&gt;</code></em> es muy importante por diversas razones, ya sea <strong>SEO</strong> o para informar en sección del sitio nos encontramos. Generalmente (aunque no siempre sucede) tu Theme ya cuenta la etiqueta <em><code>&lt;title&gt;</code></em> optimizada donde cambia automáticamente según en la pagina/post que nos encontremos. O tal vez cuentes con algún plugin que te permita cambiar el titulo desde su respectivo panel.</p><p
style="text-align: left;">El problema surge cuando no contamos ni con un Theme Optimizado ni con un plugin que nos permita controlar el titulo.</p><p
style="text-align: left;">Por suerte desde <a
title="Custom Page Titles from Scratch" href="http://digwp.com/2010/04/custom-page-titles/">Digging into WordPress </a>nos acercan una solución elegante: Mediante de una serie de filtros crearemos un nuevo panel donde podremos tomar control del titulo.</p><p
style="text-align: left;">Lo primero que necesitamos hacer deshacernos de la etiqueta <em><code>&lt;title&gt;</code></em> dentro de <em><code>header.php</code></em> por completo, ya que vamos a insertarla luego por medios de filtros.</p><p
style="text-align: center;"><img
class="alignnone size-full wp-image-2906" title="removetitle" src="http://eliseos.net/wp-content/uploads/2010/04/removetitle.png" alt="removetitle Toma control del titulo de cada post" width="590" height="248" /></p><p><span
id="more-2905"></span></p><h2>Nuestra nueva función</h2><p
style="text-align: left;">En tu archivo <em><code>functions.php</code></em> vamos a insertar lo siguiente:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Custom Page Titles</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'admin_menu'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'custom_title'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'save_post'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'save_custom_title'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_head'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'insert_custom_title'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> custom_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	add_meta_box<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'custom_title'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Change page title'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'custom_title_input_function'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'normal'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'high'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	add_meta_box<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'custom_title'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Change page title'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'custom_title_input_function'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'page'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'normal'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'high'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> custom_title_input_function<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;input type=&quot;hidden&quot; name=&quot;custom_title_input_hidden&quot; id=&quot;custom_title_input_hidden&quot; value=&quot;'</span><span style="color: #339933;">.</span>wp_create_nonce<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'custom-title-nonce'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;input type=&quot;text&quot; name=&quot;custom_title_input&quot; id=&quot;custom_title_input&quot; style=&quot;width:100%;&quot; value=&quot;'</span><span style="color: #339933;">.</span>get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'_custom_title'</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> save_custom_title<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post_id</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>wp_verify_nonce<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'custom_title_input_hidden'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'custom-title-nonce'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #000088;">$post_id</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DOING_AUTOSAVE'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> DOING_AUTOSAVE<span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #000088;">$post_id</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$customTitle</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'custom_title_input'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	update_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post_id</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'_custom_title'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$customTitle</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> insert_custom_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$customTitle</span> <span style="color: #339933;">=</span> get_post_meta<span style="color: #009900;">&#40;</span>get_the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'_custom_title'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$customTitle</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;title&gt;<span style="color: #006699; font-weight: bold;">$customTitle</span>&lt;/title&gt;&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;title&gt;&quot;</span><span style="color: #339933;">;</span>
	      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_tag<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	         single_tag_title<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Tag Archive for &amp;quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&amp;quot; - '</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
	      <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span>is_archive<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	         wp_title<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">' Archive - '</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
	      <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span>is_404<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span>is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #009900;">&#40;</span>is_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span>is_front_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	         wp_title<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">' - '</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
	      <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span>is_404<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	         <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Not Found - '</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
	      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_home<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	         bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">' - '</span><span style="color: #339933;">;</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'description'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
	      <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	          bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
	      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$paged</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	         <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">' - page '</span><span style="color: #339933;">.</span> <span style="color: #000088;">$paged</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/title&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span>
rewind_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p
style="text-align: left;">Con esto lo que estamos haciendo, es insertar un nuevo box que aparecerá cuando  escribamos o editemos una entrada. Luego la información generada se guarde cada vez que se se salve la entrada y por ultimo nuestro nuevo titulo se inserte en el <strong>header</strong> por medio de filtros.</p><p
style="text-align: left;">Nuestro nuevo <em><code>&lt;title&gt;</code></em> es guardado como un <strong>custom field</strong>, pero como el Key<strong> &#8220;_custom_title&#8221; </strong>comienza con un guion bajo, este no se refleja en nuestra lista de custom fields, por lo que no molestara.</p><p
style="text-align: center;"><img
class="alignnone size-full wp-image-2907" title="custompagetitle" src="http://eliseos.net/wp-content/uploads/2010/04/custompagetitle.png" alt="custompagetitle Toma control del titulo de cada post" width="590" height="194" /></p><p
style="text-align: left;">Cada vez que entres a editar o crear una entrada vas a encontrar un nuevo box donde podrás tomar control por completo de la etiqueta <em><code>&lt;title&gt;</code></em></p> ]]></content:encoded> <wfw:commentRss>http://eliseos.net/toma-control-titulo-cada-post/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Mostrar tus ultimas entradas de la manera correcta</title><link>http://eliseos.net/mostrar-ultimas-entradas-manera-correcta/</link> <comments>http://eliseos.net/mostrar-ultimas-entradas-manera-correcta/#comments</comments> <pubDate>Sat, 24 Apr 2010 22:26:37 +0000</pubDate> <dc:creator>Alexis</dc:creator> <category><![CDATA[Wordpress]]></category> <category><![CDATA[hack]]></category><guid
isPermaLink="false">http://eliseos.net/?p=2900</guid> <description><![CDATA[Como lo sabrás el Core de WordPress es de los mas extenso y te podes encontrar día a día con funciones que te pueden servir de salvavidas. Una de estas funciones es precisamente wp_get_recent_posts() que nos devolverá una ]]></description> <content:encoded><![CDATA[<p
style="text-align: left;">Como lo sabrás el <strong>Core de WordPress</strong> es de los mas extenso y te podes encontrar día a día con funciones que te pueden servir de salvavidas. Una de estas funciones es precisamente <em><code>wp_get_recent_posts()</code></em> que nos devolverá una lista con los Post más recientes.</p><p><span
id="more-2900"></span></p><p
style="text-align: left;">Generalmente para lograr este cometido trabajamos con un <em><code>query_post()</code></em> un plugin o simplemente una consulta a la <strong>base de datos</strong>. Pero que mejor que utilizar el mismo Core de WordPress para esto?</p><h2>Implementación</h2><p
style="text-align: left;">Donde necesites mostrar tus ultimas entradas, puedes insertar lo siguiente:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">&lt;ul&gt;
  &lt;li&gt;
    &lt;h2&gt;Entradas Recientes&lt;/h2&gt;
    &lt;ul&gt;
    <span style="color: #000000; font-weight: bold;">&lt;?php</span>
      <span style="color: #000088;">$number_recents_posts</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">// Mostrar solo las ultimas 5 entradas</span>
      <span style="color: #000088;">$recent_posts</span> <span style="color: #339933;">=</span> wp_get_recent_posts<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$number_recents_posts</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$recent_posts</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt;&lt;a href=&quot;'</span> <span style="color: #339933;">.</span> get_permalink<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;ID&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; title=&quot;Leer '</span><span style="color: #339933;">.</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;post_title&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; &gt;'</span> <span style="color: #339933;">.</span>   <span style="color: #000088;">$post</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;post_title&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/a&gt; &lt;/li&gt; '</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;</pre></div></div><p
style="text-align: left;">Como veras <a
title="Function Reference/wp get recent posts" href="http://codex.wordpress.org/Function_Reference/wp_get_recent_posts">la función</a> es de lo mas básica, ya que solo cuenta con un solo parámetro: <strong>$num</strong> que es lo define cuantas entradas se mostrar.</p><p
style="text-align: left;">Por ultimo la función es de lo mas flexible, por lo que podrás incluir cualquier hook ya conocido, como insertar Thumbnails, Tags, etc en tu nueva lista de entradas recientes.</p> ]]></content:encoded> <wfw:commentRss>http://eliseos.net/mostrar-ultimas-entradas-manera-correcta/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>
<!-- Served from: eliseos.net @ 2010-09-03 14:34:59 by W3 Total Cache -->