<?php global $wpdb; global $wp_query; $postID = $wp_query->post->ID; $queryStr = "select meta_value from wp_postmeta where meta_key = 'sectionNav' AND post_id ='" . $postID . "';";
I am executing this code outside the loop and am trying to figure out what the current postID is of the page being drawn.
The code above returns the postID from searches, however.
What reliable way is there to determine if the page being drawn has a particular metakey? (The code above on search pages seems to return a postID, that is the problem).