<?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>Bufa Webmaster &#187; Funciones</title>
	<atom:link href="http://www.bufa.es/web/wordpress/funciones-wp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bufa.es</link>
	<description>Recursos web en español</description>
	<lastBuildDate>Wed, 01 Sep 2010 20:50:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>WordPress: añadir campo excerpt a las páginas</title>
		<link>http://www.bufa.es/excerpt-paginas/</link>
		<comments>http://www.bufa.es/excerpt-paginas/#comments</comments>
		<pubDate>Wed, 25 Aug 2010 17:28:40 +0000</pubDate>
		<dc:creator>bufa</dc:creator>
				<category><![CDATA[Funciones]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[excerpt]]></category>
		<category><![CDATA[functions.php]]></category>

		<guid isPermaLink="false">http://www.bufa.es/?p=500</guid>
		<description><![CDATA[Ya sabemos que el campo excerpt esta por defecto solo en los post o entradas del administrador de wordpress, pero y si queremos utilizarlo por ejemplo en las páginas&#8230; Insertar el campo excerpt en páginas es muy simple, abrimos nuestro ...]]></description>
			<content:encoded><![CDATA[<p>Ya sabemos que el campo <strong>excerpt</strong> esta por defecto solo en los post o entradas del administrador de wordpress, pero y si queremos utilizarlo por ejemplo en las páginas&#8230;</p>
<p>Insertar el campo excerpt en páginas es muy simple, abrimos nuestro archivo <strong>functions.php</strong> que se encuentra en el raiz de nuestro tema de wordpress y agregamos la siguientes líneas php:</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;">'init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_custom_init'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> my_custom_init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> 
  add_post_type_support<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'page'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'excerpt'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#93;</span></pre></div></div>

<p>Y para visualizar el contenido del excerpt de las páginas (como si fueran post o entradas):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> the_excerpt<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bufa.es/excerpt-paginas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: Excluir ultimo post en el query</title>
		<link>http://www.bufa.es/excluir-ultimo-post/</link>
		<comments>http://www.bufa.es/excluir-ultimo-post/#comments</comments>
		<pubDate>Sun, 27 Jun 2010 09:04:44 +0000</pubDate>
		<dc:creator>bufa</dc:creator>
				<category><![CDATA[Funciones]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[offset]]></category>
		<category><![CDATA[query_post]]></category>

		<guid isPermaLink="false">http://www.bufa.es/?p=441</guid>
		<description><![CDATA[Puede que en nuestro tema de wordpress nos interese alguna vez no mostrar el último post o entrada en una determinada sección de nuestra web&#8230; para ello utilizaremos la función query_post y su parámetro offset (al cual le podemos indicar ...]]></description>
			<content:encoded><![CDATA[<p>Puede que en nuestro tema de wordpress nos interese alguna vez no mostrar el <strong>último post o entrada</strong> en una determinada sección de nuestra web&#8230; para ello utilizaremos la función <strong>query_post</strong> y su parámetro <strong>offset</strong> (al cual le podemos indicar el número de entradas a excluir).</p>
<p>A continuación vamos a listar los 5 post más recientes (posts_per_page=5) excluyendo solo el último (offset=1):</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;">// el Query</span>
query_posts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'posts_per_page=5&amp;offset=1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// el Loop</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #339933;">..</span>
<span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">else</span><span style="color: #339933;">:</span>
 <span style="color: #339933;">..</span>
<span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// reseteamos Query</span>
wp_reset_query<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bufa.es/excluir-ultimo-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: Permitir al usuario &#8220;colaborador&#8221; subir archivos</title>
		<link>http://www.bufa.es/permitir-colaborador-subir-archivos/</link>
		<comments>http://www.bufa.es/permitir-colaborador-subir-archivos/#comments</comments>
		<pubDate>Sat, 12 Jun 2010 21:43:18 +0000</pubDate>
		<dc:creator>bufa</dc:creator>
				<category><![CDATA[Funciones]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[colaborador]]></category>
		<category><![CDATA[functions.php]]></category>

		<guid isPermaLink="false">http://www.bufa.es/?p=409</guid>
		<description><![CDATA[Si tenéis varios usuarios (de tipo o perfíl &#8220;colaborador&#8220;) que escriben en vuestro a tu blog e wordpress, es probable que necesitéis algún día que puedan subir archivos o fotos a los post. Esta acción por defecto esta desactivada para ...]]></description>
			<content:encoded><![CDATA[<p>Si tenéis varios usuarios (de tipo o perfíl &#8220;<strong>colaborador</strong>&#8220;) que escriben en vuestro a tu blog e wordpress, es probable que necesitéis algún día que puedan subir archivos o fotos a los post. Esta acción por defecto esta desactivada para este tipo de usuarios (quedando oculto el menú superior del WYSIWYG de wordpress, con los iconos para poder subir imágenes, video, audio o otros objetos&#8230;).</p>
<p>Para activar el menu de &#8220;<strong>subir/insertar</strong>&#8221; imágenes, video, audio o otros objetos&#8230; solo tenemos que editar un poco nuestro archivo <strong>functions.php</strong> (que se encuentra en la carpeta de nuestro tema):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> current_user_can<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'contributor'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span>current_user_can<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'upload_files'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
    add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'admin_init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'allow_contributor_uploads'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> allow_contributor_uploads<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$contributor</span> <span style="color: #339933;">=</span> get_role<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'contributor'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$contributor</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add_cap</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'upload_files'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bufa.es/permitir-colaborador-subir-archivos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cambiar logo wordpress del administrador</title>
		<link>http://www.bufa.es/cambiar-logo-wordpress/</link>
		<comments>http://www.bufa.es/cambiar-logo-wordpress/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 15:18:02 +0000</pubDate>
		<dc:creator>bufa</dc:creator>
				<category><![CDATA[Funciones]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[logo]]></category>

		<guid isPermaLink="false">http://www.bufa.es/?p=254</guid>
		<description><![CDATA[Es posible que alguna vez queramos cambiar el logo de wordpress que aparece en el formulario de Inicio de sesión (wp-login.php). Si no queremos buscar donde se encuentra esa imágen en toda la carpeta de wordpress y remplazarla por el ...]]></description>
			<content:encoded><![CDATA[<p>Es posible que alguna vez queramos cambiar el <strong>logo de wordpress</strong> que aparece en el formulario de Inicio de sesión (wp-login.php). Si no queremos buscar donde se encuentra esa imágen en toda la carpeta de wordpress y remplazarla por el logo nuevo&#8230; podemos usar una nueva función en el functions.php de nuestro tema de wordpress:</p>
<p>Abrimos el archivo functions.php de nuestro tema y insertamos la función:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> logo_admin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;style type=&quot;text/css&quot;&gt;
        h1 a { background-image:url('</span><span style="color: #339933;">.</span>get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_directory'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/images/minuevologo.gif); }
    &lt;/style&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'login_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'logo_admin'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bufa.es/cambiar-logo-wordpress/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Eliminar el nofollow de los comentarios en WordPress</title>
		<link>http://www.bufa.es/eliminar-nofollow-comentarios-wordpress/</link>
		<comments>http://www.bufa.es/eliminar-nofollow-comentarios-wordpress/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 13:25:12 +0000</pubDate>
		<dc:creator>bufa</dc:creator>
				<category><![CDATA[Funciones]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[comentarios]]></category>
		<category><![CDATA[nofollow]]></category>

		<guid isPermaLink="false">http://www.bufa.es/?p=251</guid>
		<description><![CDATA[Para quien no lo sepa, el wordpress de manera predeterminada incluye el atributo &#8220;nofollow&#8221; a todos los links que haya en los comentarios (tanto al link del usuario como al del contenido del comentario). El nofollow hace que los buscadores ...]]></description>
			<content:encoded><![CDATA[<p>Para quien no lo sepa, el wordpress de manera predeterminada incluye el atributo &#8220;<strong>nofollow</strong>&#8221; a todos los links que haya en los comentarios (tanto al link del usuario como al del contenido del comentario). El nofollow hace que los buscadores no sigan ese enlace, aunque el usuario sí pueda pulsar en él e ir a la página a que se enlaza. El nofollow no da popularidad a las páginas enlazadas con este atributo, pero ese número de enlaces si que es tenido en cuenta para la división total del valor de los enlaces que tenemos en esa página.</p>
<p>Si eso no nos importa y queremos dar popularidad a todos los enlaces que insertan en los comentarios podemos hacer una función para remplazar el texto &#8220;nofollow&#8221; por &#8220;follow&#8221; que es el que tienen todos los enlaces por defecto.</p>
<p>Abrimos el archivo &#8220;functions.php&#8221; y añadimos la función para remplazar la cadena nofollow en nuestros comentarios de wordpress:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> eliminar_nofollow<span style="color: #009900;">&#40;</span><span style="color: #000088;">$cadena</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$string</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'nofollow'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'follow'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$cadena</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$cadena</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'comment_text'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'eliminar_nofollow'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// buscamos en el texto del comentario insertado</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'get_comment_author_link'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'eliminar_nofollow'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// buscamos en el link del usuario</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bufa.es/eliminar-nofollow-comentarios-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Función mostrar número de comentarios en WordPress</title>
		<link>http://www.bufa.es/funcion-numero-comentarios-wordpress/</link>
		<comments>http://www.bufa.es/funcion-numero-comentarios-wordpress/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 23:59:25 +0000</pubDate>
		<dc:creator>bufa</dc:creator>
				<category><![CDATA[Funciones]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[comentarios]]></category>
		<category><![CDATA[función]]></category>

		<guid isPermaLink="false">http://www.bufa.es/?p=133</guid>
		<description><![CDATA[Vamos a crear una sencilla función en php para mostrar el número total de comentarios aprobados en nuestros post de wordpress. Para ello utilizamos la función COUNT() en la sentencia sql...]]></description>
			<content:encoded><![CDATA[<p>Vamos a crear una sencilla función en php para mostrar el <strong>número total de comentarios</strong> aprobados en nuestros post de wordpress. Para ello utilizamos la función <strong>COUNT()</strong> en la sentencia sql:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> numero_comentarios<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>get_var<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SELECT COUNT(*) FROM '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>comments <span style="color: #339933;">.</span> <span style="color: #0000ff;">' WHERE comment_approved = &quot;1&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bufa.es/funcion-numero-comentarios-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Función mostrar número total de post en WordPress</title>
		<link>http://www.bufa.es/funcion-numero-post-wordpress/</link>
		<comments>http://www.bufa.es/funcion-numero-post-wordpress/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 23:45:54 +0000</pubDate>
		<dc:creator>bufa</dc:creator>
				<category><![CDATA[Funciones]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[función]]></category>
		<category><![CDATA[total]]></category>

		<guid isPermaLink="false">http://www.bufa.es/?p=130</guid>
		<description><![CDATA[Vamos a crear una sencilla función en php para mostrar el número total de post publicados en nuestros blogs wordpress...]]></description>
			<content:encoded><![CDATA[<p>Vamos a crear una sencilla función en php para mostrar el <strong>número total de post</strong> publicados en nuestros blogs wordpress:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> numero_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>get_var<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SELECT COUNT(*) FROM '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>posts <span style="color: #339933;">.</span> <span style="color: #0000ff;">' WHERE post_status = &quot;publish&quot; AND post_type = &quot;post&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bufa.es/funcion-numero-post-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
