<?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>Be Studios - blog</title>
	<atom:link href="http://www.be-studios.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.be-studios.com/blog</link>
	<description>design, life and mixed stuff</description>
	<lastBuildDate>Mon, 16 Jan 2012 21:06:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Set permalink from functions.php</title>
		<link>http://www.be-studios.com/blog/2012/01/16/set-permalink-from-functions-php/</link>
		<comments>http://www.be-studios.com/blog/2012/01/16/set-permalink-from-functions-php/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 21:06:25 +0000</pubDate>
		<dc:creator>jorge</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.be-studios.com/blog/?p=152</guid>
		<description><![CDATA[To set your favorite permalink structure from the beggining, add this on functions.php: function set_permalink(){ global $wp_rewrite; $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%postname%/'); } add_action('init', 'set_permalink'); Other value for example: /%postname%/]]></description>
			<content:encoded><![CDATA[<p>To set your favorite permalink structure from the beggining, add this on functions.php:</p>
<p><span id="more-152"></span></p>
<pre>function set_permalink(){
    global $wp_rewrite;
    $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%postname%/');
}
add_action('init', 'set_permalink');</pre>
<p>Other value for example:</p>
<pre>/%postname%/</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.be-studios.com/blog/2012/01/16/set-permalink-from-functions-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: Display Most Popular (Viewed) Posts without a plugin</title>
		<link>http://www.be-studios.com/blog/2011/11/30/wordpress-display-most-popular-viewed-posts-without-a-plugin/</link>
		<comments>http://www.be-studios.com/blog/2011/11/30/wordpress-display-most-popular-viewed-posts-without-a-plugin/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 21:57:13 +0000</pubDate>
		<dc:creator>jorge</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.be-studios.com/blog/?p=106</guid>
		<description><![CDATA[OK this one was tricky, but resolved. With this method you can display most popular posts by views (not by comments, in my casi I hadn&#8217;t comment on each post). It uses a custom-value that records each hit on each post and then it is possible to query them by meta-value: Add this on functions.php: [...]]]></description>
			<content:encoded><![CDATA[<p>OK this one was tricky, but resolved. With this method you can display most popular posts by views (not by comments, in my casi I hadn&#8217;t comment on each post). It uses a custom-value that records each hit on each post and then it is possible to query them by meta-value:</p>
<p>Add this on functions.php:</p>
<p><span id="more-106"></span></p>
<pre>function getPostViews($postID){
    $count_key = 'post_views_count';
    $count = get_post_meta($postID, $count_key, true);
    if($count==''){
        delete_post_meta($postID, $count_key);
        add_post_meta($postID, $count_key, '0');
        return "0 View";
    }
    return $count.' Views';
}
function setPostViews($postID) {
    $count_key = 'post_views_count';
    $count = get_post_meta($postID, $count_key, true);
    if($count==''){
        $count = 0;
        delete_post_meta($postID, $count_key);
        add_post_meta($postID, $count_key, '0');
    }else{
        $count++;
        update_post_meta($postID, $count_key, $count);
    }
}</pre>
<p>The add this when the loop starts within single.php:</p>
<pre>setPostViews(get_the_ID());</pre>
<p>Finally, query the posts by this meta-value, por example in the sidebar.php:</p>
<pre>&lt;?php
	query_posts('meta_key=post_views_count&#038;orderby=meta_value_num&#038;order=DESC');
	if (have_posts()) : while (have_posts()) : the_post(); ?>
	&lt;li&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;?php
	endwhile; endif;
	wp_reset_query();
?&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.be-studios.com/blog/2011/11/30/wordpress-display-most-popular-viewed-posts-without-a-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress redirect Dashboard for non-admin users</title>
		<link>http://www.be-studios.com/blog/2011/08/09/wordpress-redirect-dashboard-for-non-admin-users/</link>
		<comments>http://www.be-studios.com/blog/2011/08/09/wordpress-redirect-dashboard-for-non-admin-users/#comments</comments>
		<pubDate>Tue, 09 Aug 2011 15:03:29 +0000</pubDate>
		<dc:creator>jorge</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.be-studios.com/blog/2011/08/09/wordpress-redirect-dashboard-for-non-admin-users/</guid>
		<description><![CDATA[Easy one: this function redirects any user that hasn`t administrator capabilities to que home page of your site, if they try to access wp-admin/ add_action('admin_menu', 'redirect_dashboard'); function redirect_dashboard(){ if( !current_user_can('level_10') ){ if( preg_match('#wp-admin/?(index.php)?$#', $_SERVER['REQUEST_URI']) &#038;&#038; ('index.php' != $menu[$page][2]) ) wp_redirect(get_bloginfo('url')); } } Just include it to you theme&#8217;s functions.php.]]></description>
			<content:encoded><![CDATA[<p>Easy one: this function redirects any user that hasn`t <strong>administrator</strong> capabilities to que home page of your site, if they try to access <strong>wp-admin/</strong><br />
<span id="more-99"></span></p>
<pre>add_action('admin_menu', 'redirect_dashboard');
function redirect_dashboard(){
	if( !current_user_can('level_10') ){
		if( preg_match('#wp-admin/?(index.php)?$#', $_SERVER['REQUEST_URI']) &#038;&#038; ('index.php' != $menu[$page][2]) ) wp_redirect(get_bloginfo('url')); 
	} 
}</pre>
<p>Just include it to you theme&#8217;s <strong>functions.php</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.be-studios.com/blog/2011/08/09/wordpress-redirect-dashboard-for-non-admin-users/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Menu: Fixed section menu for pages</title>
		<link>http://www.be-studios.com/blog/2011/06/24/wordpress-menu-fixed-section-menu-for-pages/</link>
		<comments>http://www.be-studios.com/blog/2011/06/24/wordpress-menu-fixed-section-menu-for-pages/#comments</comments>
		<pubDate>Fri, 24 Jun 2011 21:13:19 +0000</pubDate>
		<dc:creator>jorge</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.be-studios.com/blog/2011/06/24/wordpress-menu-fixed-section-menu-for-pages/</guid>
		<description><![CDATA[With this PHP function you can create a hierarchical and navigational menu for your pages in WordPress. It will take the top parent page and keep it as a title, and then build their children pages keeping the hierarchy and the same markup used in wp_list_pages(); &#60;?php if(!$post-&#62;post_parent){ $children = wp_list_pages("title_li=&#38;child_of=".$post-&#62;ID."&#38;echo=0"); }else{ if($post-&#62;ancestors){ $ancestors = [...]]]></description>
			<content:encoded><![CDATA[<p>With this PHP function you can create a hierarchical and navigational menu for your pages in <strong>WordPress</strong>. It will take the top parent page and keep it as a title, and then build their children pages keeping the hierarchy and the same markup used in wp_list_pages();<br />
<span id="more-98"></span></p>
<pre>&lt;?php
    if(!$post-&gt;post_parent){
        $children = wp_list_pages("title_li=&amp;child_of=".$post-&gt;ID."&amp;echo=0");
    }else{
        if($post-&gt;ancestors){
            $ancestors = end($post-&gt;ancestors);
            $children = wp_list_pages("title_li=&amp;child_of=".$ancestors."&amp;echo=0");
        }
    }
	if($post-&gt;post_parent != 0){
		$id_padre=$post-&gt;post_parent;
		$finder=1;
		while($finder==1){
			$padre=get_post($id_padre);
			if($padre-&gt;post_parent==0){
				$id_search=$padre-&gt;ID;
				$finder=0;
         	}else{
             	$id_padre=$padre-&gt;post_parent;
         	}
     	}
	}else{
	$padre = $post;
        $id_search=$post-&gt;ID;
    }
?&gt;
&lt;h4 class="pagetitle"&gt;&lt;span&gt;&lt;?php echo $padre-&gt;post_title; ?&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;?php
    if ($children){
        echo'&lt;div id="submenu"&gt;';
        echo'&lt;ul&gt;';
        echo $children;
        echo'&lt;/ul&gt;';
        echo'&lt;/div&gt;';
    }
?&gt;</pre>
<p>Thanks to <strong>Santiago Fica</strong> fromÂ <a href="http://www.macrotech.cl" target="_blank">Macrotech</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.be-studios.com/blog/2011/06/24/wordpress-menu-fixed-section-menu-for-pages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Easy 404 redirect</title>
		<link>http://www.be-studios.com/blog/2011/06/17/easy-404-redirect/</link>
		<comments>http://www.be-studios.com/blog/2011/06/17/easy-404-redirect/#comments</comments>
		<pubDate>Fri, 17 Jun 2011 18:44:37 +0000</pubDate>
		<dc:creator>jorge</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.be-studios.com/blog/2011/06/17/easy-404-redirect/</guid>
		<description><![CDATA[Put this code in your 404.php template and every page Not Found will be redirected to your index.php: &#60;?php   header("HTTP/1.1 301 Moved Permanently");   header("Location: ".get_bloginfo('url'));   exit(); ?&#62;]]></description>
			<content:encoded><![CDATA[<p>Put this code in your <strong>404.php</strong> template and every page <strong>Not Found</strong> will be redirected to your <strong>index.php</strong>:</p>
<pre>&lt;?php
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: ".get_bloginfo('url'));
    exit();
?&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.be-studios.com/blog/2011/06/17/easy-404-redirect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get first image attached to a post</title>
		<link>http://www.be-studios.com/blog/2011/05/25/get-first-image-attached-to-a-post/</link>
		<comments>http://www.be-studios.com/blog/2011/05/25/get-first-image-attached-to-a-post/#comments</comments>
		<pubDate>Wed, 25 May 2011 22:42:48 +0000</pubDate>
		<dc:creator>jorge</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.be-studios.com/blog/2011/05/25/get-first-image-attached-to-a-post/</guid>
		<description><![CDATA[Useful: function get_post_image($size = 'thumbnail') { global $post; $photos = get_children( array('post_parent' =&#62; $post-&#62;ID, 'post_status' =&#62; 'inherit', 'post_type' =&#62; 'attachment', 'post_mime_type' =&#62; 'image', 'order' =&#62; 'ASC', 'orderby' =&#62; 'menu_order ID') ); if ($photos) { $photo = array_shift($photos); return wp_get_attachment_image($photo-&#62;ID, $size); } return false; } To print it on the HTML, echo this function with the [...]]]></description>
			<content:encoded><![CDATA[<p>Useful:</p>
<pre>function get_post_image($size = 'thumbnail') {
	global $post;
	$photos = get_children( array('post_parent' =&gt; $post-&gt;ID, 'post_status' =&gt; 'inherit', 'post_type' =&gt; 'attachment', 'post_mime_type' =&gt; 'image', 'order' =&gt; 'ASC', 'orderby' =&gt; 'menu_order ID') );
	if ($photos) {
		$photo = array_shift($photos);
		return wp_get_attachment_image($photo-&gt;ID, $size);
	}
	return false;
}</pre>
<p><span id="more-96"></span><br />
To print it on the <strong>HTML</strong>, echo this function with the size (<strong>thumbnail</strong>, <strong>medium</strong> or <strong>large</strong>):</p>
<pre>echo get_post_image('medium');</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.be-studios.com/blog/2011/05/25/get-first-image-attached-to-a-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Limit the WordPress excerpt();</title>
		<link>http://www.be-studios.com/blog/2011/05/23/limit-the-wordpress-excerpt/</link>
		<comments>http://www.be-studios.com/blog/2011/05/23/limit-the-wordpress-excerpt/#comments</comments>
		<pubDate>Tue, 24 May 2011 02:28:59 +0000</pubDate>
		<dc:creator>jorge</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.be-studios.com/blog/2011/05/23/limit-the-wordpress-excerpt/</guid>
		<description><![CDATA[Little trick: to limit the default WordPress the_excerpt(); for all posts (55 characters), include this on your functions.php: add_filter('excerpt_length', 'my_excerpt_length'); function my_excerpt_length($len) { return 25; } Where change the value that returns to anyone that ou want for your excerpt. The beauty of the technique is that it still uses the same default PHP function [...]]]></description>
			<content:encoded><![CDATA[<p>Little trick: to limit the default WordPress <strong>the_excerpt()</strong>; for all posts (55 characters), include this on your <strong>functions.php:</strong><br />
<span id="more-95"></span></p>
<pre>add_filter('excerpt_length', 'my_excerpt_length');

function my_excerpt_length($len) { return 25; }</pre>
<p>Where change the value that returns to anyone that ou want for your excerpt. The beauty of the technique is that it still uses the same default PHP function <strong>the_excerpt()</strong>;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.be-studios.com/blog/2011/05/23/limit-the-wordpress-excerpt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cita 10</title>
		<link>http://www.be-studios.com/blog/2010/09/08/cita-10/</link>
		<comments>http://www.be-studios.com/blog/2010/09/08/cita-10/#comments</comments>
		<pubDate>Wed, 08 Sep 2010 15:01:29 +0000</pubDate>
		<dc:creator>jorge</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://www.be-studios.com/blog/2010/09/08/cita-10/</guid>
		<description><![CDATA[Cuando te enfrentes a un dilema, simplemente lanza una moneda al aire. Funciona. Pero no porque con eso se decida la cuestión, sino porque durante el breve momento en que la moneda está suspedida en el aire, de repente descubres lo que deseas que suceda. Publicidad]]></description>
			<content:encoded><![CDATA[<blockquote><p>Cuando te enfrentes a un dilema, simplemente lanza una moneda al aire. <strong>Funciona.</strong> Pero no porque con eso se decida la cuestión, sino porque durante el breve momento en que la moneda está suspedida en el aire, <strong>de repente descubres lo que deseas que suceda.</strong></p></blockquote>
<p><small>Publicidad</small></p>
<p><img src="http://www.be-studios.com/blog/wp-content/uploads/2010/09/toss-a-coin.jpg" alt="Toss a Coin" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.be-studios.com/blog/2010/09/08/cita-10/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cita 9</title>
		<link>http://www.be-studios.com/blog/2010/09/02/92/</link>
		<comments>http://www.be-studios.com/blog/2010/09/02/92/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 20:37:41 +0000</pubDate>
		<dc:creator>jorge</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://www.be-studios.com/blog/2010/09/02/92/</guid>
		<description><![CDATA[Los niños muy pequeños gustan mucho de cuentos y relatos y los piden, y pueden entender cuestiones complejas expuestas como cuentos y fábulas, cuando su capacidad para captar conceptos generales, paradigmas, es casi inexistente. Esta capacidad simbólica o narrativa es la que aporta un sentido del mundo (una realidad concreta en la forma imaginativa de [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>Los niños muy pequeños gustan mucho de cuentos y relatos y los piden, y  pueden entender cuestiones complejas expuestas como cuentos y fábulas,  cuando su capacidad para captar conceptos generales, paradigmas, es casi  inexistente. Esta capacidad simbólica o narrativa es la que aporta un <em>sentido del mundo</em>  (una realidad concreta en la forma imaginativa de sí­mbolo y relato)  cuando el pensamiento abstracto no puede proporcionar ninguno. <strong>El niño sigue la Biblia antes de seguir a Euclides.</strong></p></blockquote>
<p><small><a href="http://es.wikipedia.org/wiki/Oliver_Sacks">Oliver Sacks</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.be-studios.com/blog/2010/09/02/92/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: get page link by ID</title>
		<link>http://www.be-studios.com/blog/2010/07/29/wordpress-get-page-link-by-id/</link>
		<comments>http://www.be-studios.com/blog/2010/07/29/wordpress-get-page-link-by-id/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 20:43:09 +0000</pubDate>
		<dc:creator>jorge</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.be-studios.com/blog/2010/07/29/wordpress-get-page-link-by-id/</guid>
		<description><![CDATA[This function is used to get the_permalink() of a certain page using it&#8217;s ID (outside the loop). To use it within a theme, just: &#60;?php getPageLink(ID); ?&#62; function getPageLink($pageId){ if(!is_numeric($pageId)) { return; } global $wpdb; $sql_query = 'SELECT DISTINCT * FROM ' . $wpdb->posts . ' WHERE ' . $wpdb->posts . '.ID=' . $pageId; $posts [...]]]></description>
			<content:encoded><![CDATA[<p>This function is used to get the_permalink() of a certain page using it&#8217;s ID (outside the loop). To use it within a theme, just:</p>
<pre>&lt;?php getPageLink(ID); ?&gt;</pre>
<pre>function getPageLink($pageId){
   if(!is_numeric($pageId)) {
      return;
   }
   global $wpdb;
   $sql_query = 'SELECT DISTINCT * FROM ' . $wpdb->posts . ' WHERE ' . $wpdb->posts . '.ID=' . $pageId;
   $posts = $wpdb->get_results($sql_query);
   if(!empty($posts)) {
      foreach($posts as $post) {
         return nl2br($post->guid);
      }
   }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.be-studios.com/blog/2010/07/29/wordpress-get-page-link-by-id/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

