lundi 30 mars 2015

Wordpress Custom select query transformation to Wp_Query with args

Can anyone please help me to transform the below query in Wp_query structure with args.



select post.ID, post.post_title, post.post_status, post.post_date, post.post_modified,post.post_author,ads.pack_name
from wp_posts as post
join wp_ads as ads on post.ID = ads.post_id
where post.post_type = 'ad_listing'
and post.post_status = 'publish'
order by pack_id Desc


Where Wp_ads is extra table created by me and not a default WordPress table.I want to convert it into this format so that looping and structuring can be easy.



// WP_Query arguments
$args = array (
);

// The Query
$query = new WP_Query($args);

Aucun commentaire:

Enregistrer un commentaire