I am trying to get the post id from a widget I am putting into the sidebar, but what ever I try I seem to get random post id's from other posts.
I have tried:
$id = get_the_id();
$post_id = $GLOBALS['post']->ID;
global $wp_query;
$thePostID = $wp_query->post->ID;
The template I am using is classipress and I am putting my widget into the sidebar they provide. They already have a form at the top of the sidebar which uses the post id. They use
global $post;
I have tried this also and it too gives my a different post id, but not the correct one.
I am all out of ideas at this stage.