How can I write current page ID outside the loop?
How can I write current page ID outside the loop?
Should be just $post->ID but if you get it working let me know... when I do this it keeps returning a number that is incorrect.
while $post->ID should work it's a better idea to use
$wp_query->post->ID
especially if you are going to be doing this outside of the loop.
I have once used $wp_query->post->ID, and it worked fine. But I am still not sure about it..
This topic has been closed to new replies.