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!
is what you tried use $wpdb class ? You should add
in your file and try :
I advise you read that http://codex.wordpress.org/Class_Reference/wpdb