<?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>Mas que Wordpress - Tutoriales, recursos web, JQuery y PHP, Wordpress , twitter y muchos recursos más &#187; Tutoriales</title>
	<atom:link href="http://www.masquewordpress.com/category/tutoriales/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.masquewordpress.com</link>
	<description>Tutoriales y recursos web sobre JQuery , PHP, Wordpress , twitter. Aprende diseño web y programación</description>
	<lastBuildDate>Mon, 06 Feb 2012 15:02:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Como incluir scripts en ciertas páginas de WordPress</title>
		<link>http://www.masquewordpress.com/como-incluir-scripts-en-paginas-wordpress/</link>
		<comments>http://www.masquewordpress.com/como-incluir-scripts-en-paginas-wordpress/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 19:33:40 +0000</pubDate>
		<dc:creator>Damian</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Tutoriales]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[wp_enqueue]]></category>

		<guid isPermaLink="false">http://www.masquewordpress.com/?p=1186</guid>
		<description><![CDATA[Cuando uno trabaja con templates de WordPress hay ocasiones en las que necesitamos incluir una hoja de estilo o un archivo de javascript. Para incluir dichos archivos de forma correcta WordPress nos brinda las herramientas necesarias que son: wp_enqueue_style : Función para incluir hojas de estilo wp_enqueue_script: Función para incluir scripts Antes de explicar como incluir scripts [...]]]></description>
			<content:encoded><![CDATA[<p>Cuando uno trabaja con templates de WordPress hay ocasiones en las que necesitamos incluir una hoja de estilo o un archivo de javascript. Para incluir dichos archivos de forma correcta WordPress nos brinda las herramientas necesarias que son:</p>
<ul>
<li><a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_style">wp_enqueue_style</a> : Función para incluir hojas de estilo</li>
<li><a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script">wp_enqueue_script</a>: Función para incluir scripts</li>
</ul>
<p><span id="more-1186"></span></p>
<p>Antes de explicar como incluir scripts o hojas de estilo en páginas concretas voy a explicar brevemente como se usan estas funciones para quien no las conozca.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">wp_enqueue_script<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$handle</span><span style="color: #339933;">,</span> <span style="color: #000088;">$src</span><span style="color: #339933;">,</span> <span style="color: #000088;">$deps</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ver</span><span style="color: #339933;">,</span> <span style="color: #000088;">$in_footer</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<ul>
<li><strong>$handle</strong> Es el nombre de nuestro script (no necesariamente del archivo) . Este nombre es obligatorio pero no cobra mucho sentido si no usamos la función <a href="http://codex.wordpress.org/Function_Reference/wp_register_style">wp_register_style</a> o si no hay scripts que dependen de este</li>
<li><strong>$src</strong> es la dirección url de nuestro archivo</li>
<li><strong>$deps</strong> son el archivo o archivos del cual depende nuestro script. Si nuestro script es de jQuery, depende de dicha librería. Por lo que pasaríamos un array con el $handle de jQuery como muestro en el ejemplo a continuación</li>
<li><strong>$ver</strong> es la versión del archivo, pero es opcional</li>
<li><strong>$infooter</strong> Si ponemos este valor a true los scripts se cargaran en el footer y no en el header</li>
</ul>
<p>Podemos cargar un script entonces de la siguiente manera:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">wp_enqueue_script<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'cufon-yui'</span><span style="color: #339933;">,</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'stylesheet_directory'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/js/cufon-yui.js'</span> <span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'jquery'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Para las hojas de estilo es prácticamente igual:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">wp_enqueue_style<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$handle</span><span style="color: #339933;">,</span> <span style="color: #000088;">$src</span><span style="color: #339933;">,</span> <span style="color: #000088;">$deps</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ver</span><span style="color: #339933;">,</span> <span style="color: #000088;">$media</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<ul>
<li><strong>$handle</strong> Es el nombre de nuestra hoja de estilo (no necesariamente del archivo) . Este nombre es obligatorio pero no cobra mucho sentido si no usamos la función <a href="http://codex.wordpress.org/Function_Reference/wp_register_style">wp_register_style</a></li>
<li><strong>$src</strong> es la dirección url de nuestro archivo</li>
<li><strong>$deps</strong> son el archivo o archivos del cual depende nuestra hoja de estilo.</li>
<li><strong>$ver</strong> es la versión del archivo, pero es opcional</li>
<li><strong>$media</strong> es el medio destinado como screen , print, <a href="http://www.w3.org/TR/CSS2/media.html#media-types">etc</a></li>
</ul>
<h4>Ahora veamos como incluir un script o hoja de estilo en una sola página.</h4>
<p>Si hemos creado un archivo de jQuery para un formulario que hemos echo nosotros , no queremos que dicho archivo se cargue en todas las páginas de wordpress ya que sería en vano.<br />
Para cargarlo en un página en concreto sin embargo necesitaremos usar un <a href="http://codex.wordpress.org/Plugin_API/Action_Reference">action hook</a> ya que de por si la función <strong>is_page() no funciona dentro de functions.php</strong></p>
<p>Si nuestra página es por ejemplo <strong>http://www.masquewordpress.com/ayuda</strong> deberemos hacer 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> mqw_scripts_paginas<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>is_page<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ayuda'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> wp_enqueue_script<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'forms'</span><span style="color: #339933;">,</span>get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'stylesheet_directory'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/js/forms.js'</span><span style="color: #339933;">,</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'jquery'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_redirect'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'mqw_scripts_paginas'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Básicamente lo que hacemos es llamar a la función is_page una vez que los archivos del template han sido cargados para que así funcione correctamente.</p>
<p>Espero que les haya servido de ayuda. Saludos!!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.masquewordpress.com/como-incluir-scripts-en-paginas-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Como activar tus plugins de WordPress automáticamente</title>
		<link>http://www.masquewordpress.com/activar-plugins-wordpress-automaticamente/</link>
		<comments>http://www.masquewordpress.com/activar-plugins-wordpress-automaticamente/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 13:25:12 +0000</pubDate>
		<dc:creator>Damian</dc:creator>
				<category><![CDATA[Tutoriales]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[plugins wordpress]]></category>
		<category><![CDATA[tips de wordpress]]></category>

		<guid isPermaLink="false">http://www.masquewordpress.com/?p=1182</guid>
		<description><![CDATA[Si por algún motivo queremos activar plugins automáticamente ya sea porque estamos creado un theme de wordpress que requiera ciertos plugins o por cualquier otro motivo, lo podemos usar modificando la tabla options de WordPress, más concretamente dentro de dicha tabla activate_plugins. Para ello hay que tener en cuenta que necesitaremos el nombre del archivo del [...]]]></description>
			<content:encoded><![CDATA[<p>Si por algún motivo queremos activar plugins automáticamente ya sea porque estamos creado un theme de wordpress que requiera ciertos plugins o por cualquier otro motivo, lo podemos usar modificando la tabla <strong><em>options </em></strong>de WordPress, más concretamente dentro de dicha tabla <em><strong>activate_plugins.</strong></em></p>
<p>Para ello hay que tener en cuenta que necesitaremos el nombre del archivo del plugin y no su nombre. Por ejemplo para activar <a href="http://www.masquewordpress.com/obtener-clave-api-akismet-gratis/">Akismet</a> necesitaremos saber que el archivo se llama <em><strong>&#8216;akismet/akismet.php&#8217;.</strong></em></p>
<p><span id="more-1182"></span></p>
<p>Para obtener un listado de los nombres de archivos de sus plugin pueden usar esta función de manera temporal. Para ello colóquenla en functions.php y refresquen una vez cualquier página de su sitio para ver los resultados.</p>
<p>&nbsp;</p>

<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;">'plugin_row_meta'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'fb_get_plugin_string'</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>
<span style="color: #000000; font-weight: bold;">function</span> fb_get_plugin_string<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$plugin_meta</span><span style="color: #339933;">,</span> <span style="color: #000088;">$plugin_file</span><span style="color: #339933;">,</span> <span style="color: #000088;">$plugin_data</span><span style="color: #339933;">,</span> <span style="color: #000088;">$status</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// imprime el nombre del archivo</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;code&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$plugin_file</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/code&gt;&lt;br&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$plugin_meta</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>&nbsp;<br />
Una vez tengamos nuestros nombre de archivos podemos usarlos para activar los plugins automáticamente:</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_init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'fb_activate_plugins'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//función que activa los plugins</span>
<span style="color: #000000; font-weight: bold;">function</span> fb_activate_plugins<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> <span style="color: #339933;">!</span> current_user_can<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'activate_plugins'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
		wp_die<span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No tienes permisos suficientes.'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$plugins</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$plugins</span> <span style="color: #339933;">=</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'active_plugins'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// obtenemos los plugins ya activados</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$plugins</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// array de plugins para activar</span>
		<span style="color: #000088;">$pugins_to_active</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
			<span style="color: #0000ff;">'hello.php'</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Hello Dolly</span>
			<span style="color: #0000ff;">'adminimize/adminimize.php'</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Adminimize</span>
			<span style="color: #0000ff;">'akismet/akismet.php'</span> <span style="color: #666666; font-style: italic;">// Akismet</span>
		<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #666666; font-style: italic;">// si no estan activados los agregamos al listado de plugins y actualizamos</span>
		<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$pugins_to_active</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$plugin</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> <span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$plugin</span><span style="color: #339933;">,</span> <span style="color: #000088;">$plugins</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #990000;">array_push</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$plugins</span><span style="color: #339933;">,</span> <span style="color: #000088;">$plugin</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				update_option<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'active_plugins'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$plugins</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span> 
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Con eso ya podremos activar los plugins que queramos de forma automática. Saludos!!!</p>
<p>Via: http://wpengineer.com/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.masquewordpress.com/activar-plugins-wordpress-automaticamente/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Paginación PHP con clase</title>
		<link>http://www.masquewordpress.com/paginacion-php-con-clase/</link>
		<comments>http://www.masquewordpress.com/paginacion-php-con-clase/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 18:48:23 +0000</pubDate>
		<dc:creator>Damian</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutoriales]]></category>
		<category><![CDATA[paginacion]]></category>

		<guid isPermaLink="false">http://www.masquewordpress.com/?p=1177</guid>
		<description><![CDATA[Últimamente ando revisando mis posts antiguos y en esta ocasión quería mostrarles una clase de paginación echa en PHP que es más fácil y prolija de usar que el  que publique hace tiempo. Creo que esta forma es la adecuada y aunque no entiendan o manejen clases de PHP , es un buen momento para [...]]]></description>
			<content:encoded><![CDATA[<p>Últimamente ando revisando mis posts antiguos y en esta ocasión quería mostrarles una <a href="http://www.catchmyfame.com/2011/10/23/php-pagination-class-updated-version-2/">clase de paginación echa en PHP</a> que es más fácil y prolija de usar que el <a href="http://www.masquewordpress.com/paginacion-con-php-y-mysql-3-estilos/">código de Paginación PHP</a> que publique hace tiempo. Creo que esta forma es la adecuada y aunque no entiendan o manejen clases de PHP , es un buen momento para salpicarse un poco en este mundillo.<br />
<span id="more-1177"></span><br />
Para empezar les quiero mostrar 2 ejemplos de esta clase:</p>
<ol>
<li><a href="http://www.catchmyfame.com/paginator/example.2.php?page=5&#038;ipp=25">Ejemplo básico</a></li>
<li><a href="http://www.catchmyfame.com/paginator/example-form.2.php?page=3&#038;ipp=25&#038;tb1=Europe">Ejemplo donde se arrastran variables en cada página</a></li>
</ol>
<h2>Métodos de la clase</h2>
<ul>
<li>Paginator. Constructor. Como usar:

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$pages</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Paginator<span style="color: #339933;">;</span></pre></div></div>

</li>
<li>paginate. Calcula las páginas a mostrar. Como usar:

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$pages</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">paginate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
<li>display_items_per_page. Devuelve una cadena HTML para mostrar items por página. Como usar:

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span>  <span style="color: #000088;">$pages</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display_items_per_page</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
<li>display_jump_menu. Devuelve una cadena HTML para mostrar el salto de página. Como usar:

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> <span style="color: #000088;">$pages</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display_jump_menu</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
<li>display_pages. Devuelve la cadena HTML que muestra lás paginas. Como usar:

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> <span style="color: #000088;">$pages</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display_pages</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
</ul>
<h2>Ahora veamos como usar realmente la clase</h2>
<ol>
<li>Incluimos la clase:

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'paginator.class.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
<li>Creamos el objeto paginator:

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$pages</span><span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Paginator<span style="color: #339933;">;</span></pre></div></div>

</li>
<li>Configuramos el total de resultados de nuestra query. Para ello podemos usar una COUNT(*) que devuelva la cantidad total de resutados:

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$pages</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">items_total</span> <span style="color: #339933;">=</span> X<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// cambiamos X por el total</span></pre></div></div>

</li>
<li>Configuramos el total de links a mostrar. Por ejemplo el valor por defecto es 7 . Si estamos en la pág 50 mostraria : 47 47 49 50 51 52 53

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$pages</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">mid_range</span> <span style="color: #339933;">=</span> X<span style="color: #339933;">;</span></pre></div></div>

</li>
<li>Llamamos al método paginate para que cree la paginación (este método no devuelve nada)

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$pages</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">paginate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
<li>Imprimimos las páginas que hemos páginado en el paso anterior:

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> <span style="color: #000088;">$pages</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display_pages</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
<li>Opcionalmente se pueden usar los métodos de display_jump_menu o display_items_per_page</li>
<li>Como ya tenemos la paginación generada ya podemos usar <strong>$pages->limit</strong> en nuestra query para limitar los resultados. Por ej:

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">SELECT id<span style="color: #339933;">,</span> name<span style="color: #339933;">,</span> address FROM table ORDER BY id ASC <span style="color: #000088;">$pages</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">limit</span></pre></div></div>

</li>
</ol>
<p>Con estos pasos ya tendremos funcionando la clase PHP para paginar resultados.</p>
<p>Para darle estilo pueden aplicar el que el desarrollador usa por defecto o pueden probar a adaptar algún otro estilo como los descriptos en <a href="http://www.masquewordpress.com/paginacion-con-php-y-mysql-3-estilos/">este otro post</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">&lt;style type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span><span style="color: #00AA00;">&gt;</span>
<span style="color: #6666ff;">.paginate</span> <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Arial<span style="color: #00AA00;">,</span> Helvetica<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">.7em</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
a<span style="color: #6666ff;">.paginate</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;">#000080</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">6px</span> <span style="color: #933;">2px</span> <span style="color: #933;">6px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000080</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
a<span style="color: #6666ff;">.paginate</span><span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000080</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#FFF</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">underline</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
a<span style="color: #6666ff;">.current</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;">#000080</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span> <span style="color: #933;">.7em</span> Arial<span style="color: #00AA00;">,</span>Helvetica<span style="color: #00AA00;">,</span><span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">6px</span> <span style="color: #933;">2px</span> <span style="color: #933;">6px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">cursor</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">default</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#000080</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#FFF</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
span<span style="color: #6666ff;">.inactive</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>
<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Arial<span style="color: #00AA00;">,</span> Helvetica<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">.7em</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">6px</span> <span style="color: #933;">2px</span> <span style="color: #933;">6px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#999</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">cursor</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">default</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&lt;/style<span style="color: #00AA00;">&gt;</span></pre></div></div>

<p>Y por último aquí tienen la clase PHP encargada de todo:</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;">/*
 * PHP Pagination Class
 * @author admin@catchmyfame.com - http://www.catchmyfame.com
 * @version 2.0.0
 * @date October 18, 2011
 * @copyright (c) admin@catchmyfame.com (www.catchmyfame.com)
 * @license CC Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) - http://creativecommons.org/licenses/by-sa/3.0/
 */</span>
<span style="color: #000000; font-weight: bold;">class</span> Paginator<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$items_per_page</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$items_total</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$current_page</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$num_pages</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$mid_range</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$low</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$limit</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$return</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$default_ipp</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$querystring</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$ipp_array</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> Paginator<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">current_page</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">mid_range</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">7</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ipp_array</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">25</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">50</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">100</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'All'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">items_per_page</span> <span style="color: #339933;">=</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;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ipp'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ipp'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">default_ipp</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> paginate<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><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">default_ipp</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">default_ipp</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">25</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ipp'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'All'</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">num_pages</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//			$this-&gt;items_per_page = $this-&gt;default_ipp;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">else</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">is_numeric</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">items_per_page</span><span style="color: #009900;">&#41;</span> OR <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">items_per_page</span> <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">items_per_page</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">default_ipp</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">num_pages</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ceil</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">items_total</span><span style="color: #339933;">/</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">items_per_page</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">current_page</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'page'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'page'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// must be numeric &gt; 0</span>
		<span style="color: #000088;">$prev_page</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">current_page</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$next_page</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">current_page</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$args</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'QUERY_STRING'</span><span style="color: #009900;">&#93;</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;">$args</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$arg</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$keyval</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;=&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$arg</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;">$keyval</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: #0000ff;">&quot;page&quot;</span> And <span style="color: #000088;">$keyval</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: #0000ff;">&quot;ipp&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">querystring</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&amp;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$arg</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$val</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;">$key</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;page&quot;</span> And <span style="color: #000088;">$key</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;ipp&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">querystring</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&amp;<span style="color: #006699; font-weight: bold;">$key</span>=<span style="color: #006699; font-weight: bold;">$val</span>&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">num_pages</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">return</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">current_page</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span> And <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">items_total</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">&quot;&lt;a class=<span style="color: #000099; font-weight: bold;">\&quot;</span>paginate<span style="color: #000099; font-weight: bold;">\&quot;</span> href=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #006699; font-weight: bold;">$_SERVER[PHP_SELF]</span>?page=<span style="color: #006699; font-weight: bold;">$prev_page</span>&amp;ipp=<span style="color: #006699; font-weight: bold;">$this-&gt;items_per_page</span><span style="color: #006699; font-weight: bold;">$this-&gt;querystring</span><span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&amp;laquo; Previous&lt;/a&gt; &quot;</span><span style="color: #339933;">:</span><span style="color: #0000ff;">&quot;&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>inactive<span style="color: #000099; font-weight: bold;">\&quot;</span> href=<span style="color: #000099; font-weight: bold;">\&quot;</span>#<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&amp;laquo; Previous&lt;/span&gt; &quot;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">start_range</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">current_page</span> <span style="color: #339933;">-</span> <span style="color: #990000;">floor</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">mid_range</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">end_range</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">current_page</span> <span style="color: #339933;">+</span> <span style="color: #990000;">floor</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">mid_range</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">start_range</span> <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">end_range</span> <span style="color: #339933;">+=</span> <span style="color: #990000;">abs</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">start_range</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">start_range</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</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;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">end_range</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">num_pages</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">start_range</span> <span style="color: #339933;">-=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">end_range</span><span style="color: #339933;">-</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">num_pages</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">end_range</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">num_pages</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">range</span> <span style="color: #339933;">=</span> <span style="color: #990000;">range</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">start_range</span><span style="color: #339933;">,</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">end_range</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">&lt;=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">num_pages</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">++</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;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">range</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">2</span> And <span style="color: #000088;">$i</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">range</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">return</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot; ... &quot;</span><span style="color: #339933;">;</span>
				<span style="color: #666666; font-style: italic;">// loop through all pages. if first, last, or in range, display</span>
				<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">1</span> Or <span style="color: #000088;">$i</span><span style="color: #339933;">==</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">num_pages</span> Or <span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">,</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">range</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
					<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">return</span> <span style="color: #339933;">.=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">current_page</span> And <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'page'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'All'</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">&quot;&lt;a title=<span style="color: #000099; font-weight: bold;">\&quot;</span>Go to page <span style="color: #006699; font-weight: bold;">$i</span> of <span style="color: #006699; font-weight: bold;">$this-&gt;num_pages</span><span style="color: #000099; font-weight: bold;">\&quot;</span> class=<span style="color: #000099; font-weight: bold;">\&quot;</span>current<span style="color: #000099; font-weight: bold;">\&quot;</span> href=<span style="color: #000099; font-weight: bold;">\&quot;</span>#<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;<span style="color: #006699; font-weight: bold;">$i</span>&lt;/a&gt; &quot;</span><span style="color: #339933;">:</span><span style="color: #0000ff;">&quot;&lt;a class=<span style="color: #000099; font-weight: bold;">\&quot;</span>paginate<span style="color: #000099; font-weight: bold;">\&quot;</span> title=<span style="color: #000099; font-weight: bold;">\&quot;</span>Go to page <span style="color: #006699; font-weight: bold;">$i</span> of <span style="color: #006699; font-weight: bold;">$this-&gt;num_pages</span><span style="color: #000099; font-weight: bold;">\&quot;</span> href=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #006699; font-weight: bold;">$_SERVER[PHP_SELF]</span>?page=<span style="color: #006699; font-weight: bold;">$i</span>&amp;ipp=<span style="color: #006699; font-weight: bold;">$this-&gt;items_per_page</span><span style="color: #006699; font-weight: bold;">$this-&gt;querystring</span><span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;<span style="color: #006699; font-weight: bold;">$i</span>&lt;/a&gt; &quot;</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;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">range</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">mid_range</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">num_pages</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span> And <span style="color: #000088;">$i</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">range</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">mid_range</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">return</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot; ... &quot;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">return</span> <span style="color: #339933;">.=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">current_page</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">num_pages</span> And <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">items_total</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span> And <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'page'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'All'</span><span style="color: #009900;">&#41;</span> And <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">current_page</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">&quot;&lt;a class=<span style="color: #000099; font-weight: bold;">\&quot;</span>paginate<span style="color: #000099; font-weight: bold;">\&quot;</span> href=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #006699; font-weight: bold;">$_SERVER[PHP_SELF]</span>?page=<span style="color: #006699; font-weight: bold;">$next_page</span>&amp;ipp=<span style="color: #006699; font-weight: bold;">$this-&gt;items_per_page</span><span style="color: #006699; font-weight: bold;">$this-&gt;querystring</span><span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;Next &amp;raquo;&lt;/a&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">:</span><span style="color: #0000ff;">&quot;&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>inactive<span style="color: #000099; font-weight: bold;">\&quot;</span> href=<span style="color: #000099; font-weight: bold;">\&quot;</span>#<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&amp;raquo; Next&lt;/span&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">return</span> <span style="color: #339933;">.=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'page'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'All'</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">&quot;&lt;a class=<span style="color: #000099; font-weight: bold;">\&quot;</span>current<span style="color: #000099; font-weight: bold;">\&quot;</span> style=<span style="color: #000099; font-weight: bold;">\&quot;</span>margin-left:10px<span style="color: #000099; font-weight: bold;">\&quot;</span> href=<span style="color: #000099; font-weight: bold;">\&quot;</span>#<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;All&lt;/a&gt; <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">:</span><span style="color: #0000ff;">&quot;&lt;a class=<span style="color: #000099; font-weight: bold;">\&quot;</span>paginate<span style="color: #000099; font-weight: bold;">\&quot;</span> style=<span style="color: #000099; font-weight: bold;">\&quot;</span>margin-left:10px<span style="color: #000099; font-weight: bold;">\&quot;</span> href=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #006699; font-weight: bold;">$_SERVER[PHP_SELF]</span>?page=1&amp;ipp=All<span style="color: #006699; font-weight: bold;">$this-&gt;querystring</span><span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;All&lt;/a&gt; <span style="color: #000099; font-weight: bold;">\n</span>&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;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">&lt;=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">num_pages</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">return</span> <span style="color: #339933;">.=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">current_page</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">&quot;&lt;a class=<span style="color: #000099; font-weight: bold;">\&quot;</span>current<span style="color: #000099; font-weight: bold;">\&quot;</span> href=<span style="color: #000099; font-weight: bold;">\&quot;</span>#<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;<span style="color: #006699; font-weight: bold;">$i</span>&lt;/a&gt; &quot;</span><span style="color: #339933;">:</span><span style="color: #0000ff;">&quot;&lt;a class=<span style="color: #000099; font-weight: bold;">\&quot;</span>paginate<span style="color: #000099; font-weight: bold;">\&quot;</span> href=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #006699; font-weight: bold;">$_SERVER[PHP_SELF]</span>?page=<span style="color: #006699; font-weight: bold;">$i</span>&amp;ipp=<span style="color: #006699; font-weight: bold;">$this-&gt;items_per_page</span><span style="color: #006699; font-weight: bold;">$this-&gt;querystring</span><span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;<span style="color: #006699; font-weight: bold;">$i</span>&lt;/a&gt; &quot;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">return</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;a class=<span style="color: #000099; font-weight: bold;">\&quot;</span>paginate<span style="color: #000099; font-weight: bold;">\&quot;</span> href=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #006699; font-weight: bold;">$_SERVER[PHP_SELF]</span>?page=1&amp;ipp=All<span style="color: #006699; font-weight: bold;">$this-&gt;querystring</span><span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;All&lt;/a&gt; <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">low</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">current_page</span> <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> ? <span style="color: #cc66cc;">0</span><span style="color: #339933;">:</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">current_page</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">items_per_page</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">current_page</span> <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">items_per_page</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">limit</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ipp'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'All'</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">:</span><span style="color: #0000ff;">&quot; LIMIT <span style="color: #006699; font-weight: bold;">$this-&gt;low</span>,<span style="color: #006699; font-weight: bold;">$this-&gt;items_per_page</span>&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">function</span> display_items_per_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$items</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span>ipp<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">items_per_page</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">default_ipp</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ipp_array</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$ipp_opt</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$items</span> <span style="color: #339933;">.=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ipp_opt</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">items_per_page</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">&quot;&lt;option selected value=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #006699; font-weight: bold;">$ipp_opt</span><span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;<span style="color: #006699; font-weight: bold;">$ipp_opt</span>&lt;/option&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">:</span><span style="color: #0000ff;">&quot;&lt;option value=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #006699; font-weight: bold;">$ipp_opt</span><span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;<span style="color: #006699; font-weight: bold;">$ipp_opt</span>&lt;/option&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #0000ff;">&quot;&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>paginate<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;Items per page:&lt;/span&gt;&lt;select class=<span style="color: #000099; font-weight: bold;">\&quot;</span>paginate<span style="color: #000099; font-weight: bold;">\&quot;</span> onchange=<span style="color: #000099; font-weight: bold;">\&quot;</span>window.location='<span style="color: #006699; font-weight: bold;">$_SERVER[PHP_SELF]</span>?page=1&amp;ipp='+this[this.selectedIndex].value+'<span style="color: #006699; font-weight: bold;">$this-&gt;querystring</span>';return false<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;<span style="color: #006699; font-weight: bold;">$items</span>&lt;/select&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">function</span> display_jump_menu<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">&lt;=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">num_pages</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$option</span> <span style="color: #339933;">.=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">==</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">current_page</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">&quot;&lt;option value=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #006699; font-weight: bold;">$i</span><span style="color: #000099; font-weight: bold;">\&quot;</span> selected&gt;<span style="color: #006699; font-weight: bold;">$i</span>&lt;/option&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">:</span><span style="color: #0000ff;">&quot;&lt;option value=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #006699; font-weight: bold;">$i</span><span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;<span style="color: #006699; font-weight: bold;">$i</span>&lt;/option&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #0000ff;">&quot;&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>paginate<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;Page:&lt;/span&gt;&lt;select class=<span style="color: #000099; font-weight: bold;">\&quot;</span>paginate<span style="color: #000099; font-weight: bold;">\&quot;</span> onchange=<span style="color: #000099; font-weight: bold;">\&quot;</span>window.location='<span style="color: #006699; font-weight: bold;">$_SERVER[PHP_SELF]</span>?page='+this[this.selectedIndex].value+'&amp;ipp=<span style="color: #006699; font-weight: bold;">$this-&gt;items_per_page</span><span style="color: #006699; font-weight: bold;">$this-&gt;querystring</span>';return false<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;<span style="color: #006699; font-weight: bold;">$option</span>&lt;/select&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">function</span> display_pages<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">return</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Pueden ver más información en el post del autor: <a href="http://www.catchmyfame.com/2007/07/28/finally-the-simple-pagination-class/">http://www.catchmyfame.com/2007/07/28/finally-the-simple-pagination-class/</a></p>
<p>Saludos!!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.masquewordpress.com/paginacion-php-con-clase/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mostrar la cantidad de usuarios registrados en tu sitio WordPress</title>
		<link>http://www.masquewordpress.com/mostrar-la-cantidad-de-usuarios-registrados-en-tu-sitio-wordpress/</link>
		<comments>http://www.masquewordpress.com/mostrar-la-cantidad-de-usuarios-registrados-en-tu-sitio-wordpress/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 18:11:18 +0000</pubDate>
		<dc:creator>Damian</dc:creator>
				<category><![CDATA[Tutoriales]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[shortcode]]></category>
		<category><![CDATA[tips de wordpress]]></category>
		<category><![CDATA[usuarios]]></category>

		<guid isPermaLink="false">http://www.masquewordpress.com/?p=1175</guid>
		<description><![CDATA[Si tienen habilitado el registro de usuarios en su sitio WordPress pueden usar este pequeño tip de WordPress para mostrar el total de usuarios. Lo puede aplicar en cualquier sitio o crear un shortcode para usar en sus posts. El código es el siguiente: global $wpdb; $usuarios_totales = $wpdb-&#62;get_var&#40;&#34;SELECT COUNT(ID) FROM $wpdb-&#62;users&#34;&#41;; echo $usuarios_totales.&#34; usuarios [...]]]></description>
			<content:encoded><![CDATA[<p>Si tienen habilitado el registro de usuarios en su sitio WordPress pueden usar este pequeño tip de WordPress para mostrar el total de usuarios. Lo puede aplicar en cualquier sitio o crear un shortcode para usar en sus posts.<br />
<span id="more-1175"></span></p>
<p>El código es el siguiente:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$usuarios_totales</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_var</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT COUNT(ID) FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;users</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$usuarios_totales</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; usuarios registrados.&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Para crear un shortcode tan solo deben incluirlo dentro de una 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> mqw_usuarios_totales<span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</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;">$wpdb</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$usuarios_totales</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_var</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT COUNT(ID) FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;users</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$usuarios_totales</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; usuarios registrados.&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
add_shortcode<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'total_usuarios'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'mqw_usuarios_totales'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Y luego pueden incluirlo en cualquier post de la siguiente manera:<br />
<code>[total_usuarios]</code></p>
<p>Espero que les haya gustado. Saludos!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.masquewordpress.com/mostrar-la-cantidad-de-usuarios-registrados-en-tu-sitio-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enviar formularios con AJAX y jQuery parte II</title>
		<link>http://www.masquewordpress.com/enviar-formularios-con-ajax-y-jquery/</link>
		<comments>http://www.masquewordpress.com/enviar-formularios-con-ajax-y-jquery/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 20:33:17 +0000</pubDate>
		<dc:creator>Damian</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Tutoriales]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[formularios]]></category>
		<category><![CDATA[tutorial jquery]]></category>

		<guid isPermaLink="false">http://www.masquewordpress.com/?p=1169</guid>
		<description><![CDATA[Hace mucho tiempo escribí en el blog como enviar un formulario con AJAX y jQuery mediante el plugin jquery.form.js. A día de hoy y con mucha más experiencia en jQuery prefiero escribir mis propios códigos en lugar de utilizar tantos plugins. Por lo que hoy les voy a explicar como enviar un formulario con AJAX [...]]]></description>
			<content:encoded><![CDATA[<p>Hace mucho tiempo escribí en el blog <a href="http://www.masquewordpress.com/como-enviar-un-formulario-via-ajax-con-jquery/">como enviar un formulario con AJAX y jQuery</a> mediante el plugin jquery.form.js. A día de hoy y con mucha más experiencia en jQuery prefiero escribir mis propios códigos en lugar de utilizar tantos plugins.<br />
Por lo que hoy les voy a explicar como enviar un formulario con AJAX gracias a jQuery y sin usar ningún plugin.<br />
<span id="more-1169"></span></p>
<p>Para seguir el mismo ejemplo que en el otro post vamos a utilizar el mismo formulario:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;form id=&quot;myForm&quot; action=&quot;contacto.php&quot; method=&quot;post&quot; style=&quot;height:200px;&quot;&gt; 
    &lt;label&gt;Nombre:&lt;/label&gt; &lt;input type=&quot;text&quot; name=&quot;name&quot; /&gt; 
    &lt;label&gt;Mensaje:&lt;/label&gt; &lt;textarea name=&quot;mensaje&quot;&gt;&lt;/textarea&gt; 
    &lt;input type=&quot;submit&quot; value=&quot;Enviar&quot; /&gt; &lt;div id=&quot;ajax_loader&quot;&gt;&lt;img id=&quot;loader_gif&quot; src=&quot;loader.gif&quot; style=&quot; display:none;&quot;/&gt;&lt;/div&gt;
&lt;/form&gt;</pre></div></div>

<p>Pero ahora para enviar el formulario tan solo haremos uso de algunas funciones de jQuery como son : </p>
<ul>
<li><a href="http://api.jquery.com/serialize/">.serialize()</a> : encargada de codificar todos los valores del formulario en una cadena para ser pasada.</li>
<li><a href="http://api.jquery.com/submit/">.submit()</a>: encargada de añadir al evento submit del formulario la función que usaremos para enviar el mismo.</li>
<li><a href="http://api.jquery.com/jQuery.ajax/">jQuery.ajax()</a>: encargada de realizar AJAX request.</li>
</ul>
<p>Nuestro nuevo script quedaría de la siguiente manera:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">        $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>ready<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
&nbsp;
          $<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#myForm'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>submit<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//en el evento submit del fomulario</span>
	          event<span style="color: #339933;">.</span>preventDefault<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">//detenemos el comportamiento por default</span>
&nbsp;
			  <span style="color: #000000; font-weight: bold;">var</span> url <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>this<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>attr<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">//la url del action del formulario</span>
			  <span style="color: #000000; font-weight: bold;">var</span> datos <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>this<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #990000;">serialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// los datos del formulario</span>
			  $<span style="color: #339933;">.</span>ajax<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
				  type<span style="color: #339933;">:</span> <span style="color: #0000ff;">'POST'</span><span style="color: #339933;">,</span>
				  url<span style="color: #339933;">:</span> url<span style="color: #339933;">,</span>
				  data<span style="color: #339933;">:</span> datos<span style="color: #339933;">,</span>
				  beforeSend<span style="color: #339933;">:</span> mostrarLoader<span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">//funciones que definimos más abajo</span>
				  success<span style="color: #339933;">:</span> mostrarRespuesta  <span style="color: #666666; font-style: italic;">//funciones que definimos más abajo</span>
			   <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
          <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
&nbsp;
&nbsp;
&nbsp;
&nbsp;
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
        <span style="color: #000000; font-weight: bold;">function</span> mostrarLoader<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
              $<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#loader_gif'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>fadeIn<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;slow&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//muestro el loader de ajax</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">function</span> mostrarRespuesta <span style="color: #009900;">&#40;</span>responseText<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	          alert<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Mensaje enviado: &quot;</span><span style="color: #339933;">+</span>responseText<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">//responseText es lo que devuelve la página contacto.php. Si en contacto.php hacemos echo &quot;Hola&quot; , la variable responseText = &quot;Hola&quot; . Aca hago un alert con el valor de response text</span>
	          $<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;#loader_gif&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>fadeOut<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;slow&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Hago desaparecer el loader de ajax</span>
	          $<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;#ajax_loader&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>append<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;br&gt;Mensaje: &quot;</span><span style="color: #339933;">+</span>responseText<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Aca utilizo la función append de JQuery para añadir el responseText  dentro del div &quot;ajax_loader&quot;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p><div class="avia-box info    "><span class="avia-innerbox" >Pueden ver un ejemplo online en <a href="http://masquewordpress.com/ejemplos/enviar-formulario-con-ajax-jquery/">&#8220;Como enviar un formulario AJAX con jQuery&#8221;</a></span></div><br />
<div class="avia-box download   rounded "><span class="avia-innerbox" >Pueden descargar el código antiguo en <a href="http://www.masquewordpress.com/como-enviar-un-formulario-via-ajax-con-jquery/">este post</a> </span></div></p>
]]></content:encoded>
			<wfw:commentRss>http://www.masquewordpress.com/enviar-formularios-con-ajax-y-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cambiar el tamaño del excerpt según la categoría</title>
		<link>http://www.masquewordpress.com/cambiar-el-tamano-del-excerpt-segun-la-categoria/</link>
		<comments>http://www.masquewordpress.com/cambiar-el-tamano-del-excerpt-segun-la-categoria/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 15:20:00 +0000</pubDate>
		<dc:creator>Damian</dc:creator>
				<category><![CDATA[Tutoriales]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[excerpt]]></category>
		<category><![CDATA[tips de wordpress]]></category>

		<guid isPermaLink="false">http://www.masquewordpress.com/?p=1167</guid>
		<description><![CDATA[Terminando con la serie de tips de wordpress sobre el excerpt les traigo una forma para cambiar el tamaño del excerpt que podrán adaptar para cambiar el tamaño del mismo según la categoría que se muestre. Para ello hay que usar el filtro de wordpress llamado excerpt_length al cual le podemos pasar cualquier valor que [...]]]></description>
			<content:encoded><![CDATA[<p>Terminando con la serie de <a href="http://www.masquewordpress.com/tag/tips-de-wordpress/">tips de wordpress</a> sobre el <a href="http://www.masquewordpress.com/tag/excerpt/">excerpt</a> les traigo una forma para cambiar el tamaño del excerpt que podrán adaptar para cambiar el tamaño del mismo según la categoría que se muestre.<br />
<span id="more-1167"></span></p>
<p>Para ello hay que usar el filtro de wordpress llamado <strong>excerpt_length</strong> al cual le podemos pasar cualquier valor que queramos.<br />
Por ejemplo para cambiar el tamaño de nuestro excerpt a 40 debemos hacer lo siguiente:</p>

<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;">'excerpt_length'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'mqw_largo_excerpt'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> mqw_largo_excerpt<span style="color: #009900;">&#40;</span><span style="color: #000088;">$largo</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
           <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">40</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>En cambio si queremos tener un diferente tamaño para cada categoría tan solo necesitaremos los id de las categorías y hacer lo siguiente:</p>

<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;">'excerpt_length'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'mqw_largo_excerpt'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> mqw_largo_excerpt<span style="color: #009900;">&#40;</span><span style="color: #000088;">$largo</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>in_category<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">20</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;">return</span> <span style="color: #cc66cc;">80</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Les gusto este truco? Espero que si!! Saludos!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.masquewordpress.com/cambiar-el-tamano-del-excerpt-segun-la-categoria/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comprobar si el post tiene excerpt</title>
		<link>http://www.masquewordpress.com/comprobar-si-el-post-tiene-excerpt/</link>
		<comments>http://www.masquewordpress.com/comprobar-si-el-post-tiene-excerpt/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 15:08:28 +0000</pubDate>
		<dc:creator>Damian</dc:creator>
				<category><![CDATA[Tutoriales]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[excerpt]]></category>
		<category><![CDATA[tips de wordpress]]></category>

		<guid isPermaLink="false">http://www.masquewordpress.com/?p=1163</guid>
		<description><![CDATA[Siguiendo con la serie de tips de wordpress sobre el excerpt , hoy les traigo una forma de comprobar si el post tiene o no excerpt en caso de que queramos mostrar algo diferente. Para ello tan solo hacemos : &#60;?php if&#40;!empty&#40;$post-&#62;post_excerpt&#41;&#41; &#123; // El post tiene excerpt , y lo mostramos the_excerpt&#40;&#41;; &#125; else [...]]]></description>
			<content:encoded><![CDATA[<p>Siguiendo con la serie de tips de wordpress sobre el <a href="http://www.masquewordpress.com/tag/excerpt/">excerpt</a> , hoy les traigo una forma de comprobar si el post tiene o no excerpt en caso de que queramos mostrar algo diferente.<br />
<span id="more-1163"></span></p>
<p>Para ello tan solo hacemos :</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;">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;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_excerpt</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #666666; font-style: italic;">// El post tiene excerpt , y lo mostramos</span>
     the_excerpt<span style="color: #009900;">&#40;</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>
     <span style="color: #666666; font-style: italic;">// El post no tiene, que hacemos?</span>
 <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Espero que les haya sido de utilidad!! Saludos!!</p>
<p>Via: <a href="http://www.wprecipes.com/how-to-check-out-if-a-post-has-an-excerpt" rel="nofollow">Wprecipes</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.masquewordpress.com/comprobar-si-el-post-tiene-excerpt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quitar [...] del excerpt de wordpress</title>
		<link>http://www.masquewordpress.com/quitar-del-excerpt-de-wordpress/</link>
		<comments>http://www.masquewordpress.com/quitar-del-excerpt-de-wordpress/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 15:02:55 +0000</pubDate>
		<dc:creator>Damian</dc:creator>
				<category><![CDATA[Tutoriales]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[excerpt]]></category>
		<category><![CDATA[tips de wordpress]]></category>

		<guid isPermaLink="false">http://www.masquewordpress.com/?p=1161</guid>
		<description><![CDATA[Los tengo un poco abandonados con los Tips de WordPress , pero este año empezó con mucho trabajo y últimamente no tengo tiempo. Recuerden que si quieren colaborar lo pueden hacer enviando sus tips de wordpress. Y si están bien redactados y el tip es original lo publico con un link a vuestra web. Y [...]]]></description>
			<content:encoded><![CDATA[<p>Los tengo un poco abandonados con los Tips de WordPress , pero este año empezó con mucho trabajo y últimamente no tengo tiempo. Recuerden que si quieren colaborar lo pueden hacer <a href="http://www.masquewordpress.com/envianos-tu-tip-de-wordpress/">enviando sus tips de wordpress</a>. Y si están bien redactados y el tip es original lo publico con un link a vuestra web.</p>
<p>Y ahora volviendo a tema, cuando queremos quitar [...] del extracto o excerpt que wordpress inserta automáticamente tan solo debemos hacer lo siguiente:<br />
<span id="more-1161"></span></p>
<p>En functions.php colocamos:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> mqw_trim_excerpt<span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #990000;">rtrim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'[...]'</span><span style="color: #009900;">&#41;</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_the_excerpt'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'mqw_trim_excerpt'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Saludos, espero que les haya sigo útil!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.masquewordpress.com/quitar-del-excerpt-de-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Detectar pais, provincia y ciudad de procedencia mediante la IP</title>
		<link>http://www.masquewordpress.com/detectar-pais-provincia-y-ciudad-mediante-ip/</link>
		<comments>http://www.masquewordpress.com/detectar-pais-provincia-y-ciudad-mediante-ip/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 19:08:01 +0000</pubDate>
		<dc:creator>Damian</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Recursos]]></category>
		<category><![CDATA[Tutoriales]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[iplocation]]></category>
		<category><![CDATA[tips de wordpress]]></category>

		<guid isPermaLink="false">http://www.masquewordpress.com/?p=1154</guid>
		<description><![CDATA[El tip de wordpress de hoy es para poder detectar y mostrar la ubicación de sus visitantes mediante la dirección IP de los mismos. Aunque este tip puede usarse para cualquier otro proyecto, hoy les voy a enseñar como integrarlo en wordpress. Si todo es correcto, tu mi querido usuario deber estar ubicado en: Para [...]]]></description>
			<content:encoded><![CDATA[<p>El tip de wordpress de hoy es para poder detectar y mostrar la ubicación de sus visitantes mediante la dirección IP de los mismos. Aunque este tip puede usarse para cualquier otro proyecto, hoy les voy a enseñar como integrarlo en wordpress.</p>
<p>Si todo es correcto, tu mi querido usuario deber estar ubicado en: -, -</p>
<p><span id="more-1154"></span></p>
<p>Para ello vamos primero a crear un shortcode llamado &#8220;iplocation&#8221; que usaremos para mostrar los datos. Para ello en nuestro functions.php copiamos la siguiente 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> mqw_iplocation<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: #b1b100;">return</span> mqw_iplocation_func<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REMOTE_ADDR'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_shortcode<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'iplocation'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'mqw_iplocation'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Por último la función que devuelve la ubicación mediante IP. Esta función la saque de http://snipplr.com/view/48386/detect-location-by-ip-city-state/ que usa un servicio gratuito llamado http://ipinfodb.com/ aunque existen de pago y mejores (más exactitud de los datos y mayor actualización de las IP).</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> mqw_iplocation_func<span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #000088;">$default</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Mar del Plata, Bs As, Argentina'</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;">is_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$ip</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'127.0.0.1'</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$ip</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'localhost'</span><span style="color: #009900;">&#41;</span>
            <span style="color: #000088;">$ip</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'8.8.8.8'</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$curlopt_useragent</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)'</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://ipinfodb.com/ip_locator.php?ip='</span> <span style="color: #339933;">.</span> <span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$curl_opt</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            CURLOPT_FOLLOWLOCATION  <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span>
            CURLOPT_HEADER      <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span>
            CURLOPT_RETURNTRANSFER  <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span>
            CURLOPT_USERAGENT   <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$curlopt_useragent</span><span style="color: #339933;">,</span>
            CURLOPT_URL       <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$url</span><span style="color: #339933;">,</span>
            CURLOPT_TIMEOUT         <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span>
            CURLOPT_REFERER         <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'http://'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #990000;">curl_setopt_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> <span style="color: #000088;">$curl_opt</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</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;">is_null</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_info</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$curl_info</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_getinfo</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'{&lt;li&gt;City : ([^&lt;]*)&lt;/li&gt;}i'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$content</span><span style="color: #339933;">,</span> <span style="color: #000088;">$regs</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>  <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$city</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$regs</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: #009900;">&#125;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'{&lt;li&gt;State/Province : ([^&lt;]*)&lt;/li&gt;}i'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$content</span><span style="color: #339933;">,</span> <span style="color: #000088;">$regs</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>  <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$state</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$regs</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: #009900;">&#125;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'{&lt;li&gt;Country : ([^&lt;]*)&lt;/li&gt;}i'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$content</span><span style="color: #339933;">,</span> <span style="color: #000088;">$regs</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>  <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$country</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$regs</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: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$city</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">''</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$state</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">''</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$country</span> <span style="color: #339933;">!=</span><span style="color: #0000ff;">''</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
          <span style="color: #000088;">$location</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$city</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">', '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$state</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">', '</span><span style="color: #339933;">.</span> <span style="color: #000088;">$country</span><span style="color: #339933;">;</span>
          <span style="color: #b1b100;">return</span> <span style="color: #000088;">$location</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;">return</span> <span style="color: #000088;">$default</span><span style="color: #339933;">;</span> 
        <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Espero que les haya gustado. Saludos!!</p>
<p>Ahh me olvidaba, tan solo tienen que usar el shortcode de la siguiente manera:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009900;">&#91;</span>iplocation<span style="color: #009900;">&#93;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.masquewordpress.com/detectar-pais-provincia-y-ciudad-mediante-ip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Como mejorar la función the_excerpt() de WordPress</title>
		<link>http://www.masquewordpress.com/como-mejorar-la-funcion-the_excerpt-de-wordpress/</link>
		<comments>http://www.masquewordpress.com/como-mejorar-la-funcion-the_excerpt-de-wordpress/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 17:16:39 +0000</pubDate>
		<dc:creator>Damian</dc:creator>
				<category><![CDATA[Tutoriales]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[excerpt]]></category>
		<category><![CDATA[tips de wordpress]]></category>

		<guid isPermaLink="false">http://www.masquewordpress.com/?p=1149</guid>
		<description><![CDATA[Hoy les traigo un tip de wordpress que sirve para mejorar la función the_excerpt() de wordpress que es la encargada de mostrar un extracto de nuestro post. El tamaño del extracto viene predefinido, con la siguiente función podremos cambiar eso de forma variable y elegir un tamaño de excerpt diferente siempre que lo necesitemos. Primero [...]]]></description>
			<content:encoded><![CDATA[<p>Hoy les traigo un tip de wordpress que sirve para mejorar la función the_excerpt() de wordpress que es la encargada de mostrar un extracto de nuestro post. El tamaño del extracto viene predefinido, con la siguiente función podremos cambiar eso de forma variable y elegir un tamaño de excerpt diferente siempre que lo necesitemos.</p>
<p><span id="more-1149"></span><br />
Primero añadimos en functions.php lo siguiente</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Función que imprime el excerpt.</span>
<span style="color: #000000; font-weight: bold;">function</span> print_excerpt<span style="color: #009900;">&#40;</span><span style="color: #000088;">$length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// length es la cantidad máxima de caracteres a msotrar</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_excerpt</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">''</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$text</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> get_the_content<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: #000088;">$text</span> <span style="color: #339933;">=</span> apply_filters<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_content'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">']]&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">']]&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> strip_shortcodes<span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// opcional pero recomendado que quita los shortcodes</span>
	<span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// usar ' $text = strip_tags($text,'&lt;p&gt;&lt;a&gt;'); ' si se quieren dejar algunas etiquetas.</span>
&nbsp;
	<span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #000088;">$length</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$excerpt</span> <span style="color: #339933;">=</span> reverse_strrchr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'.'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</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;">$excerpt</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> apply_filters<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_excerpt'</span><span style="color: #339933;">,</span><span style="color: #000088;">$excerpt</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>
		<span style="color: #b1b100;">echo</span> apply_filters<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_excerpt'</span><span style="color: #339933;">,</span><span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> reverse_strrchr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$haystack</span><span style="color: #339933;">,</span> <span style="color: #000088;">$needle</span><span style="color: #339933;">,</span> <span style="color: #000088;">$trail</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #990000;">strrpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$haystack</span><span style="color: #339933;">,</span> <span style="color: #000088;">$needle</span><span style="color: #009900;">&#41;</span> ? <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$haystack</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #990000;">strrpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$haystack</span><span style="color: #339933;">,</span> <span style="color: #000088;">$needle</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$trail</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Para usarlo tan solo llamamos a la función de la siguiente forma.</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> print_excerpt<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Espero que les haya servido!!Saludos!</p>
<p>Via: <a href="http://www.distractedbysquirrels.com/blog/wordpress-improved-dynamic-excerpt/" rel="nofollow">Sebastian</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.masquewordpress.com/como-mejorar-la-funcion-the_excerpt-de-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

