I have been working with a third party wishlist module that causes some issues. Overcoming many of them I have one left.
The architecture of everything in our website is this:
- 12 Products
- 1 Random Category
The above loops with infinite scroll paging until the last page.
So, to achieve this I am using WP_Query.
However the plugin I am working on for the wishlist display page has the following query.
$posts = $wpdb->get_results( $wpdb->prepare( 'SELECT b.ID AS posts_id, b.post_title AS posts_title, b.post_content AS posts_content, b.post_date AS posts_date, c.ID AS authors_id, c.display_name AS authors_name FROM '.$var_setting['table'].' a LEFT JOIN '.$var_setting['table_posts'].' b ON a.item_id = b.ID LEFT JOIN '.$var_setting['table_users']." c ON c.ID = b.post_author WHERE b.post_status = 'publish' AND a.user_id = %s ORDER BY b.post_title DESC", $user_id ) );
Any ideas on how I could convert this to WP_Query, able to take args ?
Thank you in advance!
Read more here: Convert SQL Query to WP_Query