<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: WordPress getting the current Page or Post ID</title>
	<atom:link href="http://www.saiweb.co.uk/php/wordpress-getting-the-current-page-or-post-id/feed" rel="self" type="application/rss+xml" />
	<link>http://www.saiweb.co.uk/php/wordpress-getting-the-current-page-or-post-id</link>
	<description>Ramblings of a Sys admin</description>
	<lastBuildDate>Mon, 06 Feb 2012 14:55:58 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Aaron Newton</title>
		<link>http://www.saiweb.co.uk/php/wordpress-getting-the-current-page-or-post-id/comment-page-1#comment-18506</link>
		<dc:creator>Aaron Newton</dc:creator>
		<pubDate>Sun, 14 Mar 2010 05:21:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=626#comment-18506</guid>
		<description>Sean is correct, however I have a slight adjustment.

The $page isn&#039;t an array, it is an object. In this sense, using print_r (print array) probably isn&#039;t the best option. Consider using var_dump as an alternative OR you can actually access the object properties directly like this:

$post-&gt;ID

This also allows you to set this as a variable for use outside the loop, e.g. 

$curr_post_id = $post-&gt;ID

I am using this to imporve the Wordpress pagination function on a site.</description>
		<content:encoded><![CDATA[<p>Sean is correct, however I have a slight adjustment.</p>
<p>The $page isn&#8217;t an array, it is an object. In this sense, using print_r (print array) probably isn&#8217;t the best option. Consider using var_dump as an alternative OR you can actually access the object properties directly like this:</p>
<p>$post-&gt;ID</p>
<p>This also allows you to set this as a variable for use outside the loop, e.g. </p>
<p>$curr_post_id = $post-&gt;ID</p>
<p>I am using this to imporve the WordPress pagination function on a site.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sean</title>
		<link>http://www.saiweb.co.uk/php/wordpress-getting-the-current-page-or-post-id/comment-page-1#comment-2751</link>
		<dc:creator>sean</dc:creator>
		<pubDate>Thu, 02 Apr 2009 21:43:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=626#comment-2751</guid>
		<description>or
&lt;pre lang=&quot;php&quot;&gt;
$content .= print_r($post, true);
&lt;/pre&gt;
get_the_ID() is handy for templates aswell in conjunction with the get_page and get_post functions.

Sean</description>
		<content:encoded><![CDATA[<p>or</p>
<pre lang="php">
$content .= print_r($post, true);
</pre>
<p>get_the_ID() is handy for templates aswell in conjunction with the get_page and get_post functions.</p>
<p>Sean</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using apc
Database Caching using apc
Object Caching 371/392 objects using apc
Content Delivery Network via Rackspace Cloud Files: cdn.saiweb.co.uk

Served from: www.saiweb.co.uk @ 2012-02-08 21:41:03 -->
