I currently have a simple
wp_query search working on my wordpress site. I now want that same search to look for results in it's own database and another one on same server.
I found that I could use
new wpdb()and then
$mydb->get_results() to get the posts. I managed to pull a title of one of the posts but now I want to integrate this into my
wp_query. Is this even possible? Here is a breakdown of the code:
$args = array( 'post_type' => 'post', 'show_posts' => '10', 'paged' => $paged ); $the_query = new WP_Query($args); // Testing the new wpdb instance (RESULT: title echoed out. Working) $mydb = new wpdb('USR','PSWD','DB','localhost'); $rows = $mydb->get_results(" SELECT * FROM wp_posts WHERE id = '5509' "); foreach ($rows as $obj) : echo $obj->post_title; endforeach; // So now, how do I use my wp_query to get these results too? // Loop if ($the_query->have_posts()) : while ($the_query->have_posts()) : $the_query->the_post();