Select Posts on a custom variable
-
All, I’ve created a custom table to store some additional data regarding my posts that I create in WordPress. I’ve like to do a select based on some of these details in my custom table. So ideally I’d select my posts based on something like this query:
Select custom.address1, custom.zip, wp_post.post_title From wp_posts Join wp_posts.ID=custom.post_id Where custom.zip='$zip'I tried to do something like this:
$blog_query = new WP_Query(); $blog_query = query_posts("SELECT * FROM wp_posts where ID='252'"); if (!$blog_query) $blog_query = $wp_query; $blogOptions = ($shortcode_values) ? $shortcode_values : $theLayout['blog']; while( $blog_query->have_posts() ) : $blog_query->the_post();Then display my content. However when I try and write my own custom query nothing is displayed. How can I create my custom query and still display the posts that I created?
Thanks for any advice in advance is greatly appreciated!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Select Posts on a custom variable’ is closed to new replies.