I'm looking to get the publish id from the widget I'm putting in to the sidebar, but no matter what I attempt I appear to obtain random publish id's using their company posts.

I've attempted:

            $id = get_the_id();

            $post_id = $GLOBALS['post']->ID;

            global $wp_query;

            $thePostID = $wp_query->post->ID;

Web site I'm using is classipress and i'm putting my widget in to the sidebar they offer. They have an application towards the top of the sidebar which utilizes the publish id. They will use

            global $post;

I've attempted this also it too gives my another publish id, although not the most appropriate one.

I'm full-scale of ideas at this time.

I am unsure I realize - why would the widget within the sidebar possess a devoted publish ID? So far as I am aware, publish ID's are saved for actual posts (or pages, even) and never elements like icons? Is the reason you are not receiving the "correct" ID be since there is not one? How are you aware exactly what the "correct id" is to begin with?