Fetch Selected Fields in WP_Query Class in WordPress -
i want fetch selected fields in wp_query class in wordpress. didn't find argument same.
args=array('tag' => $tagname,'showposts'=>$no_of_post,'caller_get_posts'=>1); $my_query = new wp_query($args);
i need title , description of post. how pass selected field in wp_query function ?
i not understand question, try answer .
first of all, wp_query not function, class.
so after $my_query = new wp_query($args);
class object available.
that means after setting data , use if want loop example :
while ( $my_query->have_posts() ) : $my_query->the_post(); echo '<li>' . get_the_title() . '</li>'; ... continue loop
or $post->id
after setting post data ( or $post->title
)
or access directly :
$my_query->post->id
all post details available normally, not sure mean description
, mean excerpt
??
Comments
Post a Comment