On a default install of WP you get always the ID of a post with the function get_the_ID()
. Id dosnt work this you go about the global var: $post
.
echo $GLOBALS['post']->ID
Is this not enough, then go about the global wp_query
$GLOBALS['wp_query']->post->ID;