[Solved] How to change a custom query into a standard loop?
In order to be able to use template tags, you have to do two things after getting your custom select query: You have to declare the global $post variable. You have to call the setup_postdata($post) function to populate the variables. So, my code had to be changed like so: $results = $wpdb->get_results($wp_query->request, OBJECT); global $post; … Read more