<?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>unsignedint &#187; WordPress</title>
	<atom:link href="http://unsignedint.net/blog/category/development/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://unsignedint.net/blog</link>
	<description>adding noise to the signal</description>
	<lastBuildDate>Sat, 10 Jul 2010 10:32:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Como obter o ID de um post dentro e fora do Loop do WordPress</title>
		<link>http://unsignedint.net/blog/2010/01/16/obter-id-de-um-post-no-wordpress/</link>
		<comments>http://unsignedint.net/blog/2010/01/16/obter-id-de-um-post-no-wordpress/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 11:46:29 +0000</pubDate>
		<dc:creator>lmmendes</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[post_id]]></category>

		<guid isPermaLink="false">http://www.unsignedint.net/blog/?p=342</guid>
		<description><![CDATA[Ultimamente tenho andado a fazer algumas modificações ao meu blog e surgiu-me a necessidade de obter o ID de um post fora do loop (The Loop) do WordPress:

&#60;?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?&#62;

Dentro do loop para obter o ID basta fazer o seguinte:

$post->ID

Já fora do loop para termos [...]]]></description>
			<content:encoded><![CDATA[<p>Ultimamente tenho andado a fazer algumas modificações ao meu blog e surgiu-me a necessidade de obter o ID de um post fora do <a href="http://codex.wordpress.org/The_Loop">loop (The Loop)</a> do WordPress:</p>
<pre name="code" class="php">
&lt;?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?&gt;
</pre>
<p>Dentro do <em>loop </em>para obter o ID basta fazer o seguinte:</p>
<pre name="code" class="php">
$post->ID
</pre>
<p>Já fora do <em>loop</em> para termos acesso ao ID do post vamos ter que aceder á variável global <em>$wp_query</em>, ou seja, para obtermos acesso ao ID do post:</p>
<pre name="code" class="php">
global $wp_query;
$wp_query->post->ID
</pre>
<p>É tão simples como isso, para saberem mais informação sobre o <em>$wp_query</em> consultem o <a href="http://codex.wordpress.org/Function_Reference/WP_Query">Codex aqui.</a></p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-love">
<ul class="socials">
		<li class="shr-comfeed">
			<a href="http://unsignedint.net/blog/2010/01/16/obter-id-de-um-post-no-wordpress/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://unsignedint.net/blog/2010/01/16/obter-id-de-um-post-no-wordpress/&amp;title=Como+obter+o+ID+de+um+post+dentro+e+fora+do+Loop+do+WordPress" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://unsignedint.net/blog/2010/01/16/obter-id-de-um-post-no-wordpress/&amp;title=Como+obter+o+ID+de+um+post+dentro+e+fora+do+Loop+do+WordPress" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://unsignedint.net/blog/2010/01/16/obter-id-de-um-post-no-wordpress/&amp;t=Como+obter+o+ID+de+um+post+dentro+e+fora+do+Loop+do+WordPress" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://unsignedint.net/blog/2010/01/16/obter-id-de-um-post-no-wordpress/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-misterwong">
			<a href="http://www.mister-wong.com/addurl/?bm_url=http://unsignedint.net/blog/2010/01/16/obter-id-de-um-post-no-wordpress/&amp;bm_description=Como+obter+o+ID+de+um+post+dentro+e+fora+do+Loop+do+WordPress&amp;plugin=sexybookmarks" rel="nofollow" class="external" title="Add this to Mister Wong">Add this to Mister Wong</a>
		</li>
		<li class="shr-mixx">
			<a href="http://www.mixx.com/submit?page_url=http://unsignedint.net/blog/2010/01/16/obter-id-de-um-post-no-wordpress/&amp;title=Como+obter+o+ID+de+um+post+dentro+e+fora+do+Loop+do+WordPress" rel="nofollow" class="external" title="Share this on Mixx">Share this on Mixx</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://unsignedint.net/blog/2010/01/16/obter-id-de-um-post-no-wordpress/&amp;title=Como+obter+o+ID+de+um+post+dentro+e+fora+do+Loop+do+WordPress" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://unsignedint.net/blog/2010/01/16/obter-id-de-um-post-no-wordpress/&amp;title=Como+obter+o+ID+de+um+post+dentro+e+fora+do+Loop+do+WordPress" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://unsignedint.net/blog/2010/01/16/obter-id-de-um-post-no-wordpress/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Como+obter+o+ID+de+um+post+dentro+e+fora+do+Loop+do+WordPress+-+http://b2l.me/m7hhd&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://unsignedint.net/blog/2010/01/16/obter-id-de-um-post-no-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove WordPress iNove theme sidebar using custom fields</title>
		<link>http://unsignedint.net/blog/2010/01/16/hide-inove-wordpress-theme-sidebar-using-custom-fields/</link>
		<comments>http://unsignedint.net/blog/2010/01/16/hide-inove-wordpress-theme-sidebar-using-custom-fields/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 01:35:37 +0000</pubDate>
		<dc:creator>lmmendes</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[inove wordpress nosidebar]]></category>

		<guid isPermaLink="false">http://www.unsignedint.net/blog/?p=295</guid>
		<description><![CDATA[I&#8217;m using WordPress iNove theme v.1.4.6 and i needed a way to hide the sidebar for a specific post so i dove in the iNove theme code and figured out how to do this with the minimum changes to the original theme code.
First open the iNove theme &#8216;header.php&#8217; file using your favorite editor, usually found [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using <a href="http://wordpress.org/extend/themes/inove">WordPress iNove theme</a> v.1.4.6 and i needed a way to hide the sidebar for a specific post so i dove in the iNove theme code and figured out how to do this with the minimum changes to the original theme code.</p>
<p>First open the iNove theme &#8216;header.php&#8217; file using your favorite editor, usually found at <em>&lt;wp install folder&gt;/wp-content/themes/inove/header.php</em>.</p>
<p>Now look for this piece of code (starting from the top of the file):</p>
<pre name="code" class="php">
... some code ...
			$feed = 'http://' . $options['feed_url'];
		}
	} else {
		$feed = get_bloginfo('rss2_url');
	}
?&gt;
</pre>
<p><span id="more-295"></span><br />
Now append at the end of that code the following snippet:</p>
<pre name="code" class="php">
&lt;?php
    global $wp_query;
    if( get_post_meta( $wp_query->post->ID, 'nosidebar', 'true') ){
        $inove_nosidebar = true;
    }
?&gt;
</pre>
<p>You should get some thing like this:</p>
<pre name="code" class="php">
... some code ...
			$feed = 'http://' . $options['feed_url'];
		}
	} else {
		$feed = get_bloginfo('rss2_url');
	}
?&gt;

&lt;?php
    global $wp_query;
    if( get_post_meta( $wp_query->post->ID, '', 'true') ){
        $inove_nosidebar = true;
    }
?&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
</pre>
<p>Now when you need to disable the sidebar in a post you simply add  a new &#8216;Custom Field&#8217; named &#8216;nosidebar&#8217; and set it&#8217;s value to &#8216;true&#8217; like you see in the figure.</p>
<p><a href="http://www.unsignedint.net/blog/wp-content/uploads/2010/01/wp_nosidebar_custom_fields.png"><img src="http://www.unsignedint.net/blog/wp-content/uploads/2010/01/wp_nosidebar_custom_fields.png" alt="Wordpress setting &#039;nosidebar&#039; custom field" title="Wordpress &#039;nosidebar&#039; Custom Fields" width="582" height="233" class="alignnone size-full wp-image-320" /></a></p>
<p>Et voilà, all done! </p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-love">
<ul class="socials">
		<li class="shr-comfeed">
			<a href="http://unsignedint.net/blog/2010/01/16/hide-inove-wordpress-theme-sidebar-using-custom-fields/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://unsignedint.net/blog/2010/01/16/hide-inove-wordpress-theme-sidebar-using-custom-fields/&amp;title=Remove+WordPress+iNove+theme+sidebar+using+custom+fields" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://unsignedint.net/blog/2010/01/16/hide-inove-wordpress-theme-sidebar-using-custom-fields/&amp;title=Remove+WordPress+iNove+theme+sidebar+using+custom+fields" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://unsignedint.net/blog/2010/01/16/hide-inove-wordpress-theme-sidebar-using-custom-fields/&amp;t=Remove+WordPress+iNove+theme+sidebar+using+custom+fields" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://unsignedint.net/blog/2010/01/16/hide-inove-wordpress-theme-sidebar-using-custom-fields/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-misterwong">
			<a href="http://www.mister-wong.com/addurl/?bm_url=http://unsignedint.net/blog/2010/01/16/hide-inove-wordpress-theme-sidebar-using-custom-fields/&amp;bm_description=Remove+WordPress+iNove+theme+sidebar+using+custom+fields&amp;plugin=sexybookmarks" rel="nofollow" class="external" title="Add this to Mister Wong">Add this to Mister Wong</a>
		</li>
		<li class="shr-mixx">
			<a href="http://www.mixx.com/submit?page_url=http://unsignedint.net/blog/2010/01/16/hide-inove-wordpress-theme-sidebar-using-custom-fields/&amp;title=Remove+WordPress+iNove+theme+sidebar+using+custom+fields" rel="nofollow" class="external" title="Share this on Mixx">Share this on Mixx</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://unsignedint.net/blog/2010/01/16/hide-inove-wordpress-theme-sidebar-using-custom-fields/&amp;title=Remove+WordPress+iNove+theme+sidebar+using+custom+fields" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://unsignedint.net/blog/2010/01/16/hide-inove-wordpress-theme-sidebar-using-custom-fields/&amp;title=Remove+WordPress+iNove+theme+sidebar+using+custom+fields" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://unsignedint.net/blog/2010/01/16/hide-inove-wordpress-theme-sidebar-using-custom-fields/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Remove+WordPress+iNove+theme+sidebar+using+custom+fields+-+http://b2l.me/m7aas&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://unsignedint.net/blog/2010/01/16/hide-inove-wordpress-theme-sidebar-using-custom-fields/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
